none
MFC feature pack - Couldn’t show the dockable pane once closed RRS feed

  • Question

  • By using the wizard, and selecting Office 2007 style, you can come up with a UI that looks like an IDE - a dockable file explorer pane on the left, and a dockable properties pane on the right.

    However, when you close these dockable panes, there's no way you can show them again, even if you recompile the project.

    I searched through some forums and looks like I'm not the only one having this problem. Is there any way to show these panes again?


    Please Help...

    Thanks...
    Friday, July 17, 2009 3:37 AM

Answers

  • Hello,

    You could add a menu command then call ShowPane() method in its handler as View does.  i.e.:

    BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWndEx)
        ON_COMMAND(ID_SHOWDOCKPANE, &CMainFrame::OnShowDockPane)
    END_MESSAGE_MAP()
    
    void CMainFrame::OnShowDockPane()
    {
        m_dockpane.ShowPane(TRUE, FALSE, TRUE);
    }



    Sincerely,
    Wesley


    Please mark the replies as answers if they help and unmark them if they provide no help. Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by BedBuffer Wednesday, July 22, 2009 2:30 AM
    Monday, July 20, 2009 7:28 AM

All replies

  • >> However, when you close these dockable panes, there's no way you can show them again, even if you recompile the project.

    Probably the previous setting is to written to some ini file or to the registry as doc/view does this sometimes. There must be someplace in the code which checks this and hides the dockable pane.

    Microsoft MVP - Visual C++
    Blog: http://nibuthomas.com
    Posts are provided as is without warranties or guaranties.
    Friday, July 17, 2009 4:27 AM
    Moderator
  • Yes, there must be some place in the code where you could find it... But I really can't find it... :(
    Friday, July 17, 2009 4:55 AM
  • There is a function called CDockablePane::LoadState , which should be the place where previous view settings are loaded. Put a breakpoint there to test where this fella is being written to.


    Microsoft MVP - Visual C++
    Blog: http://nibuthomas.com
    Posts are provided as is without warranties or guaranties.
    Friday, July 17, 2009 5:10 AM
    Moderator
  • I tried putting this block of code in CMainFrame::CreateDockingWindows() after it creates the File View Window.
           
           
    BOOL CMainFrame::CreateDockingWindows()
    {
    ...

    // Create file view
    CString strFileView;
    bNameValid = strFileView.LoadString(IDS_FILE_VIEW);
    ASSERT(bNameValid);
    if (!m_wndFileView.Create(strFileView, this, CRect(0, 0, 200, 200), TRUE, ID_VIEW_FILEVIEW, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT| CBRS_FLOAT_MULTI))
    {
    TRACE0("Failed to create File View window\n");
    return FALSE; // failed to create
    }


    m_wndFileView.EnableAutohideAll();
    m_wndFileView.EnableGripper(true);
    m_wndFileView.SetAutoHideMode(true, CBRS_ALIGN_LEFT);
    m_wndFileView.ShowPane(true,false,true);
    m_wndFileView.Slide(true);

    ....
    }
    Now its able to show the file view pane, but when you click on it, it crashes like its not a valid window and points to this ->
    _AFXWIN_INLINE void CWnd::GetWindowRect(LPRECT lpRect) const
        { ASSERT(::IsWindow(m_hWnd)); ::GetWindowRect(m_hWnd, lpRect); }

    am I putting the code in the wrong place?

    Friday, July 17, 2009 5:59 AM
  • The app *should* have a "view" menu, one of the entries lists all the dockable panes/toolbars. Selecting the items will hide or show them again.

    This should also be available on right clicking on the menu bar somewhere.

    You may need to tweak the values uiFirstUserToolBarId and uiLastUserToolBarId in the main frame file.

    Thanks
    • Proposed as answer by IssamTP Monday, November 13, 2017 3:19 PM
    Friday, July 17, 2009 7:55 AM
  • Yes, it has a view menu but only if you select "use a menu bar and toolbar" in the wizard, that way you could show the panes again that were closed. But if you select "Use a ribbon", you only have file menu - no edit, view, etc... 
    Friday, July 17, 2009 9:29 AM
  • Hello,

    You could add a menu command then call ShowPane() method in its handler as View does.  i.e.:

    BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWndEx)
        ON_COMMAND(ID_SHOWDOCKPANE, &CMainFrame::OnShowDockPane)
    END_MESSAGE_MAP()
    
    void CMainFrame::OnShowDockPane()
    {
        m_dockpane.ShowPane(TRUE, FALSE, TRUE);
    }



    Sincerely,
    Wesley


    Please mark the replies as answers if they help and unmark them if they provide no help. Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by BedBuffer Wednesday, July 22, 2009 2:30 AM
    Monday, July 20, 2009 7:28 AM