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. Problem with Splitter Wnd

Problem with Splitter Wnd

Scheduled Pinned Locked Moved C / C++ / MFC
help
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.
  • F Offline
    F Offline
    Francis B
    wrote on last edited by
    #1

    I split the view of my application in two parts. My problem is that the status bar and toolbar disappear after the split and I don't know why!!! :confused: This is my code : int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { CCreateContext* pContext = (CCreateContext*)lpCreateStruct->lpCreateParams; int rc; CRect cr; if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } // TODO: Delete these three lines if you don't want the toolbar to // be dockable m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); DockControlBar(&m_wndToolBar); GetClientRect(&cr); CSize paneSize(cr.Width() / 2, cr.Height()); m_wndSplitter.CreateStatic(this, 1, 2); if(!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CBOFListView), paneSize, pContext)) { TRACE0("Failed to create Splitter Wnd\n"); return -1; // fail to create } if(!m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CBOFInfoView), paneSize, pContext)) { TRACE0("Failed to create Splitter Wnd\n"); return -1; // fail to create } return 0; } Best Regards!

    L 1 Reply Last reply
    0
    • F Francis B

      I split the view of my application in two parts. My problem is that the status bar and toolbar disappear after the split and I don't know why!!! :confused: This is my code : int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { CCreateContext* pContext = (CCreateContext*)lpCreateStruct->lpCreateParams; int rc; CRect cr; if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } // TODO: Delete these three lines if you don't want the toolbar to // be dockable m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); DockControlBar(&m_wndToolBar); GetClientRect(&cr); CSize paneSize(cr.Width() / 2, cr.Height()); m_wndSplitter.CreateStatic(this, 1, 2); if(!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CBOFListView), paneSize, pContext)) { TRACE0("Failed to create Splitter Wnd\n"); return -1; // fail to create } if(!m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CBOFInfoView), paneSize, pContext)) { TRACE0("Failed to create Splitter Wnd\n"); return -1; // fail to create } return 0; } Best Regards!

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Try to set CSize paneSize(200,200); then try to handle the OnSize message as follows: void CMainFrame::OnSize(UINT nType, int cx, int cy) { CFrameWnd::OnSize(nType, cx, cy); CRect cr; if ( m_initSplitters && nType != SIZE_MINIMIZED ) { m_mainSplitter.GetClientRect( &cr ); m_mainSplitter.SetColumnInfo( 0, cr.Width() / 2, 0 ); m_mainSplitter.SetColumnInfo( 1, cr.Width() / 2, 0 ); m_mainSplitter.RecalcLayout(); } } m_initSplitters is a BOOL set to TRUE after the splitters have been created in the OnCreateClient-function. Use this function to create your splitters instead of the OnCreate function regards!

      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