Solved

2 pannels whith a dialog

Posted on 1998-12-15
8
306 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
  • 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

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…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
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.

713 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