Solved

2 pannels whith a dialog

Posted on 1998-12-15
8
304 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
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 user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

813 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now