Solved

2 pannels whith a dialog

Posted on 1998-12-15
8
301 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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. 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 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.

707 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

17 Experts available now in Live!

Get 1:1 Help Now