Menu

Demo Splitter add OnSize than run suspended

Help
Erik Don
2021-01-13
2021-01-14
  • Erik Don

    Erik Don - 2021-01-13

    Hello All,

    I want the splitter in Demo Splitter can be reposition by size changed, than add virural function OnSize() but CFrameT and CDocker all have virtual function called (LRESULT/void)OnSize , I have to rewrite the LRESULT version.
    LRESULT CMainFrame::OnSize(UINT msg, WPARAM wparam, LPARAM lparam)
    {
    CRect viewRect = GetViewRect();
    m_pDockTree->SetDockSize(viewRect.Height()/2);
    m_pDockList->SetDockSize(viewRect.Width()/2);
    m_pDockText->SetDockSize(viewRect.Width()/2);

    return CFrameT<CDocker>::OnSize(msg, wparam, lparam);
    

    }
    After compiling, the Splitter.exe can't be run, windows says : "Splitter.exe has stopped work, ... choose close or debug".

    How can I do if I want the splitter can be reposition by window size changed?

     
  • David

    David - 2021-01-14

    Hi Erik,

    Your OnSize code fails because m_pDockTree, m_pDockList and m_pDockTest are initially NULL.

    I encourage you to have a look at the Proportional Resize option demonstrated in the Dock sample. You may not need to override OnSize with the DS_NO_FIXED_RESIZE option set.

    Best regards,
    David

     
  • Erik Don

    Erik Don - 2021-01-14

    Hi, David,

    Thank you very much, the DS_NO_FIXED_RESIZE works for my purpose.
    In OnSize even I checked m_pDock...->IsWindow() the app still suspended.
    
     

Log in to post a comment.