Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Using CSplitterWnd OnCreateClient to split window

Using CSplitterWnd OnCreateClient to split window

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutoriallearning
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cy163 hotmail com
    wrote on last edited by
    #1

    Hi All I create a SDI project to implement splitting window using CSplitterWnd and OnCreateClient (VC 6.0). In MainFrm.h, two CSplitterWnd member variables are declared

    public:
    CMySplitter wndSplitter_horizontal;
    CMySplitter wndSplitter_erect;

    In MainFrm.cpp the OnCreateClienct function is as follows

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

    if(wndSplitter_horizontal.CreateStatic(this,2,1)==NULL)
    return FALSE;

    wndSplitter_horizontal.CreateView(0,0,RUNTIME_CLASS(CMonitorTopView),CSize(50,50),pContext);//CMonitorTopView CViewLeft

    if(wndSplitter_erect.CreateStatic(&wndSplitter_horizontal,1,2,WS_CHILD|WS_VISIBLE, wndSplitter_horizontal.IdFromRowCol(1, 0))==NULL)

    return FALSE; 
    

    wndSplitter_erect.CreateView(0,0,RUNTIME_CLASS(CViewRight),CSize(220,220),pContext);//CMonitorRightView

    wndSplitter_erect.CreateView(0,1,RUNTIME_CLASS(CViewRight),CSize(220,220),pContext); //CMonitorRightView

    return TRUE;
    }

    It works fine when a CEditView based view 'CViewRight' or 'CViewLeft' is linked to the pane with CreateView(), but failed when a CFormView based view 'CViewRight_Dlg1111' , 'CMonitorTopView' or 'CMonitorRightView' is linked to the pane, though compiling is successful. 'CViewRight_Dlg1111' is created as follows, (1) First create a dialog resource (IDD_Dlg_1111) (2)Invoke the 'New Class' dialog box Class Type: MFC class Base Class: CFormView Dialog ID: IDD_Dlg_1111 Creating 'CMonitorTopView' and 'CMonitorRightView' follows the same way. Also, I find that the program works fine when classes derived from CEditView, CTreeView, CView are linked to the pane . i do not know why. Please help I would like the program to deploy the multi-pane layout only when the user clicking a menu item, How to do this.

    E 1 Reply Last reply
    0
    • C cy163 hotmail com

      Hi All I create a SDI project to implement splitting window using CSplitterWnd and OnCreateClient (VC 6.0). In MainFrm.h, two CSplitterWnd member variables are declared

      public:
      CMySplitter wndSplitter_horizontal;
      CMySplitter wndSplitter_erect;

      In MainFrm.cpp the OnCreateClienct function is as follows

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

      if(wndSplitter_horizontal.CreateStatic(this,2,1)==NULL)
      return FALSE;

      wndSplitter_horizontal.CreateView(0,0,RUNTIME_CLASS(CMonitorTopView),CSize(50,50),pContext);//CMonitorTopView CViewLeft

      if(wndSplitter_erect.CreateStatic(&wndSplitter_horizontal,1,2,WS_CHILD|WS_VISIBLE, wndSplitter_horizontal.IdFromRowCol(1, 0))==NULL)

      return FALSE; 
      

      wndSplitter_erect.CreateView(0,0,RUNTIME_CLASS(CViewRight),CSize(220,220),pContext);//CMonitorRightView

      wndSplitter_erect.CreateView(0,1,RUNTIME_CLASS(CViewRight),CSize(220,220),pContext); //CMonitorRightView

      return TRUE;
      }

      It works fine when a CEditView based view 'CViewRight' or 'CViewLeft' is linked to the pane with CreateView(), but failed when a CFormView based view 'CViewRight_Dlg1111' , 'CMonitorTopView' or 'CMonitorRightView' is linked to the pane, though compiling is successful. 'CViewRight_Dlg1111' is created as follows, (1) First create a dialog resource (IDD_Dlg_1111) (2)Invoke the 'New Class' dialog box Class Type: MFC class Base Class: CFormView Dialog ID: IDD_Dlg_1111 Creating 'CMonitorTopView' and 'CMonitorRightView' follows the same way. Also, I find that the program works fine when classes derived from CEditView, CTreeView, CView are linked to the pane . i do not know why. Please help I would like the program to deploy the multi-pane layout only when the user clicking a menu item, How to do this.

      E Offline
      E Offline
      Eugen Podsypalnikov
      wrote on last edited by
      #2

      Please see the implementation of the derived constructor in this[^] example... :) (there are no dialog-related words inside)

      They sought it with thimbles, they sought it with care; They pursued it with forks and hope; They threatened its life with a railway-share; They charmed it with smiles and soap. :)

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups