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. Why don't splitters appear?

Why don't splitters appear?

Scheduled Pinned Locked Moved C / C++ / MFC
question
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.
  • N Offline
    N Offline
    neilsolent
    wrote on last edited by
    #1

    I am initialising GUI components (in a CMDIFrameWnd) using the code below. It works fine, except that the CMDIChildWnd child frames are blank at startup. If the user fiddles with the child windows (e.g. stretches them) then the splitter displays immediately appear. What have I missed in the initialisation ? :confused: CMainFrame* pMainFrame = new CMainFrame; if (! pMainFrame->LoadFrame(IDR_MAINFRAME)) return FALSE; CCreateContext context; context.m_pCurrentDoc = NULL; context.m_pCurrentFrame = NULL; context.m_pLastView = NULL; context.m_pNewDocTemplate = NULL; context.m_pNewViewClass = NULL; CMDIChildWnd* alertWnd = new CMDIChildWnd; alertWnd->Create(NULL, "Alerts", WS_CHILD | WS_VISIBLE | WS_OVERLAPPEDWINDOW, CFrameWnd::rectDefault, pMainFrame); CSplitterWnd* alertSplitter = new CSplitterWnd; alertSplitter->CreateStatic(alertWnd, 1, 2, WS_CHILD | WS_VISIBLE, AFX_IDW_PANE_FIRST); alertSplitter->CreateView(0, 0, RUNTIME_CLASS(CLeftView), CSize(100, 100), &context); alertSplitter->CreateView(0, 1, RUNTIME_CLASS(CSsfconView), CSize(100, 100), &context); pMainWnd->ShowWindow(SW_SHOW); pMainWnd->UpdateWindow(); cheers, Neil

    M 1 Reply Last reply
    0
    • N neilsolent

      I am initialising GUI components (in a CMDIFrameWnd) using the code below. It works fine, except that the CMDIChildWnd child frames are blank at startup. If the user fiddles with the child windows (e.g. stretches them) then the splitter displays immediately appear. What have I missed in the initialisation ? :confused: CMainFrame* pMainFrame = new CMainFrame; if (! pMainFrame->LoadFrame(IDR_MAINFRAME)) return FALSE; CCreateContext context; context.m_pCurrentDoc = NULL; context.m_pCurrentFrame = NULL; context.m_pLastView = NULL; context.m_pNewDocTemplate = NULL; context.m_pNewViewClass = NULL; CMDIChildWnd* alertWnd = new CMDIChildWnd; alertWnd->Create(NULL, "Alerts", WS_CHILD | WS_VISIBLE | WS_OVERLAPPEDWINDOW, CFrameWnd::rectDefault, pMainFrame); CSplitterWnd* alertSplitter = new CSplitterWnd; alertSplitter->CreateStatic(alertWnd, 1, 2, WS_CHILD | WS_VISIBLE, AFX_IDW_PANE_FIRST); alertSplitter->CreateView(0, 0, RUNTIME_CLASS(CLeftView), CSize(100, 100), &context); alertSplitter->CreateView(0, 1, RUNTIME_CLASS(CSsfconView), CSize(100, 100), &context); pMainWnd->ShowWindow(SW_SHOW); pMainWnd->UpdateWindow(); cheers, Neil

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      What happens if you pass NULL instead of &context to alertSplitter->CreateView()? Also, this call shouldn't be necessary - pMainWnd->UpdateWindow(); Maybe try without it. CSplitterWnd* alertSplitter should maybe be a member variable of the MDIChild class (or somewhere) so it can be deleted, otherwise a memory leak.

      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