Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » CExtSplitterWnd in a CExtResizableDialog Collapse All
Subject Author Date
Brett Cook Oct 23, 2006 - 2:59 PM

Dear Tech Support,

I am trying to get a CExtSplitterWnd to show up in a CExtResiableDialog. My setup looks like this:

    CCreateContext ccx;

    ccx.m_pCurrentFrame = (CMainFrame*)(AfxGetApp()->m_pMainWnd);
    ccx.m_pCurrentDoc = ccx.m_pCurrentFrame->GetActiveDocument();
    ccx.m_pLastView = ccx.m_pCurrentFrame->GetActiveView();

    m_wndSplitter.CreateStatic(this, 2, 1);

    ccx.m_pNewViewClass = RUNTIME_CLASS(CObjectTypesView);
    m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CObjectTypesView), CSize(0,200), &ccx);
    ccx.m_pNewViewClass = RUNTIME_CLASS(CObjectListView);
    m_wndSplitter.CreateView(1,0,RUNTIME_CLASS(CObjectListView), CSize(0,0), &ccx);

Is this correct? When I run the application, the splitter does not show up.

Thanks,
-Brett

Dominik Braendlin Jan 5, 2010 - 8:23 AM

Dear Tech Support,

I am referring to your “test_splitter_dlg” example from thread “CExtSplitterWnd in a CExtResizableDialog”.

I would like to have two splitter windows. A right and a left. The left splitter would be a list ctrl and the right splitter would be a CExtResizableDialog. So far I failed creating the right splitter dialog window.

Is it possible to use a dialog in a splitter window at all? If yes could you please give an example.

Thanks

Adrian

Technical Support Jan 6, 2010 - 9:22 AM
Technical Support Oct 24, 2006 - 7:07 AM

Here is a small project that demonstrates how to create a splitter window in a dialog. A CFrameWnd is created in the dialog as a container for the splitter window. Then two panes with CExtGridWnd objects are added to the splitter window.



Brett Cook Oct 25, 2006 - 11:51 AM

Thank you. This example was very helpful in getting my splitter wnd working.

One last refinement I am trying to add is to have the splitter bar resize to a percentage of what the whole splitter window is being resized to.

Do you know of how to do this?

Thanks
-Brett

Technical Support Oct 26, 2006 - 5:38 AM

You can handle the WM_SIZE message and implement the resizing algorithm for the first splitter pane in this way:

LRESULT CTest_splitter_dlgDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) 
{
 if( message == WM_SIZE ) 
 {
  if( m_wndSplitter.GetSafeHwnd() == NULL )
   return CExtResizableDialog::WindowProc(message, wParam, lParam);
 
  CRect rcWnd1;
  m_wndSplitter.GetClientRect( &rcWnd1 );
 
  INT cxCur = 0;
  INT cxMin = 0;
  m_wndSplitter.GetColumnInfo( 0, cxCur, cxMin );
  
  LRESULT lRes = CExtResizableDialog::WindowProc(message, wParam, lParam);
 
  CRect rcWnd2;
  m_wndSplitter.GetClientRect( &rcWnd2 );
 
  INT cxCurNew = cxCur + ( ( rcWnd2.Width() - rcWnd1.Width() ) / 2 );
  if( cxCurNew < 0 )
   cxCurNew = 0;
 
  m_wndSplitter.SetColumnInfo( 0, cxCurNew, cxMin );
  m_wndSplitter.RecalcLayout();
  
  return lRes;
 }
 return CExtResizableDialog::WindowProc(message, wParam, lParam);

Brett Cook Oct 26, 2006 - 2:59 PM

Thank you, this works great.