Solved

2 pannels whith a dialog

Posted on 1998-12-15
8
308 Views
Last Modified: 2012-06-21
I need use 2 pannels in my application. In the first - I use
CTreeView class and in the second - DetailDlg class derived from CDialog.
(like "Ole/Com Object Viewer" from MS DeveloperStudio Tools)
 I use DECLARE_DYNCREATE(DetailDlg) and IMPLEMENT_DYNCREATE(DetailDlg, CDialog).

after exequtin function
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
      // TODO: Add your specialized code here and/or call the base class

      //Create splitter for 2 pannels.      
      if (m_wndSplitter.CreateStatic(this,1,2))
      {
            CRect rect;
            GetClientRect(&rect);
            CSize size = rect.Size();
            size.cx-=100;
            
            // Run 2 view classes and set active pannel.
            if (m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CMapView),size,pContext))
            {
                  if (m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(DetailDlg),CSize(0,0),pContext))
                  {
                        SetActiveView((CView*)m_wndSplitter.GetPane(0,0));
                        return TRUE;      
                  }
            }
      }

      return CFrameWnd::OnCreateClient(lpcs, pContext);
}
I don't see my dialg.(only transperent frame)
What is a problem? Haw I can to connect to CDialog class in the pannel
When I use CView (not CDialog) this problem is not exist.
My platform Windows NT, VC++ 5.
Thanks.
0
Comment
Question by:atkach
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 

Author Comment

by:atkach
ID: 1180205
Edited text of question
0
 

Author Comment

by:atkach
ID: 1180206
Edited text of question
0
 

Author Comment

by:atkach
ID: 1180207
Edited text of question
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Accepted Solution

by:
nil_dib earned 100 total points
ID: 1180208
You have to use CFormView insted of CDialog as base class if
you want to display dialog elements,
because you can only connect to views in CSpiltterWnd.
In the CFormView you can use all resouces like in a dialog.
After drawing the dialog with the resource workshop use the class
wizzard to create a new class which is not derive from CDialog
but from CFormView!
0
 
LVL 4

Expert Comment

by:nil_dib
ID: 1180209
Look for sample MFC->general->Viewex
0
 

Author Comment

by:atkach
ID: 1180210
I prepare dialog according CFormView help and derived my class DetailDlg from CFormView.
But when I try to create this view :
   m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(DetailDlg),CSize(0,0),pContext);
I got JPF in the function CreateView.
0
 
LVL 4

Expert Comment

by:nil_dib
ID: 1180211
What is JPF?
Do you set the properties of the dialog: style = child and border = none
in the resource workshop?
I created a new project with the wizzard:
wizzard step 4 -> advanced -> window styles -> use split windows
resource workshop -> insert new dialog -> properties: style = child and border = none
-> class wizzard -> create new class (derive from CFormView).
edit CMainFrame::OnCreateClient:

BOOL CMainFrame::OnCreateClient( LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
     if (m_wndSplitter.CreateStatic(this,1,2))
     {
          CRect rect;
          GetClientRect(&rect);
          CSize size = rect.Size();
          size.cx-=100;

          if (m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CTestView),size,pContext))
          {
               if (m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(CDlgView),CSize(0,0),pContext))
               {
                    SetActiveView((CView*)m_wndSplitter.GetPane(0,0));
                    return TRUE;
               }
          }
     }
     return CFrameWnd::OnCreateClient(lpcs, pContext);
}

this works fine!?
dib
0
 

Author Comment

by:atkach
ID: 1180212
Thanks, nil_dib.
I am also found a problem whith styles of the dialog.

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question