Reputation: 147
I have 3 dockable panes, each containing 1 image. One is on the left, one on the right and one not visible. The problem is, I would like to have the one on the right hidden by default to let the one on the left take the entire space. I have searched through the doc to find I should call the following on my pane, but nothing happens.
ToggleAutoHide();
I don't know what I am missing... here is my creation code in case it helps:
// image docking panel creation
if (!m_wndRawImage.Create(_T("Raw Image"), this, imgRect, TRUE, ID_VIEW_RAWIMGWND, dwPaneStyle| CBRS_RIGHT, AFX_CBRS_REGULAR_TABS, AFX_CBRS_RESIZE))
{
TRACE0("Failed to create image tab window\n");
return -1;
}
if (!m_wndRefImage.Create(_T("Reference Image"), this, imgRect, TRUE, ID_VIEW_REFIMGWND, dwPaneStyle| CBRS_RIGHT))
{
TRACE0("Failed to create image tab window\n");
return -1;
}
if (!m_wndCalibImage.Create(_T("Calibrated Image"), this, imgRect, TRUE, ID_VIEW_CALIBIMGWND, dwPaneStyle| CBRS_RIGHT))
{
TRACE0("Failed to create image tab window\n");
return -1;
}
m_wndImagePane1.EnableDocking(CBRS_ALIGN_RIGHT | CBRS_ALIGN_LEFT);
m_wndImagePane2.EnableDocking(CBRS_ALIGN_RIGHT | CBRS_ALIGN_LEFT);
m_wndImagePane3.EnableDocking(CBRS_ALIGN_RIGHT | CBRS_ALIGN_LEFT);
CDockingManager::SetDockingMode(DT_SMART);
EnableDocking(CBRS_ALIGN_ANY);
EnableAutoHidePanes(CBRS_ALIGN_ANY);
// image panes
DockPane(&m_wndImagePane3);
CDockablePane* pTabbedBar2 = NULL;
m_wndImagePane2.AttachToTabWnd(&m_wndImagePane3, DM_SHOW, FALSE, &pTabbedBar2);
m_wndImagePane2.ShowPane(FALSE, FALSE, FALSE);
m_wndImagePane3.ShowPane(TRUE, FALSE, TRUE);
m_wndImagePane3.ToggleAutoHide(); //<---- Problem is here
DockPane(&m_wndImagePane1);
m_wndImagePane1.ShowPane(TRUE, FALSE, TRUE);
Thanks!
Upvotes: 2
Views: 2388
Reputation: 789
For the posterity.
CMainFrame
class:void CMainFrame::HidePanes()
{
m_wndProperties.ShowPane(FALSE, FALSE, FALSE);
}
CMyApp::InitInstance
method:BOOL CMyApp::InitInstance()
{
...
CMainFrame* pMainFrame = new CMainFrame;
...
pMainFrame->HidePanes();
pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->UpdateWindow();
}
Upvotes: 0
Reputation: 480
if I was understand your problem correctly, you want to hide a pane in app startup.
I use ON_WM_SHOWWINDOW()
Message to hide pane. like this:
Add this to CMainFrame
Class declaration:
afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
And add this to Message map:
ON_WM_SHOWWINDOW()
And add this to your main code:
void CMainFrame::OnShowWindow(BOOL bShow, UINT nStatus)
{
CFrameWndEx::OnShowWindow(bShow, nStatus);
// Hide Properties pane in startup
m_wndProperties.SetAutoHideMode(FALSE, CBRS_ALIGN_ANY);
m_wndProperties.ShowPane(FALSE, FALSE, FALSE);
}
Hope it can help!
Upvotes: 2