-
March 28th, 2020, 02:29 PM
#1
Restrict CDockablePane to CBRS_ALIGN_LEFT or CBRS_ALIGN_RIGHT
I need to restrict a panel, derived from CDockablePane to be float only on the left or right side. But seem that it can be float anywhere, top and bottom as well. And this CDockablePane is part of a CChildFrame, not a CMainFrame.
Here is the code:
Code:
protected:
CPropertiesWnd1 m_wndPane1;
and
Code:
int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if(CMDIChildWndEx::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
SetIcon(theApp.LoadIcon(IDR_MAINFRAME), FALSE);
// enable Visual Studio 2005 style docking window behavior
CDockingManager::SetDockingMode(DT_SMART);
// enable Visual Studio 2005 style docking window auto-hide behavior
EnableAutoHidePanes(CBRS_ALIGN_LEFT | CBRS_ALIGN_RIGHT);
CMDIChildWndEx::m_bEnableFloatingBars = TRUE;
// Create filter window
if(! m_wndPane1.Create(_T("Properties 1"), this, CRect(0, 0, 250, 500), TRUE, TRM_PANE1ID,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_RIGHT | CBRS_FLOAT_MULTI,
AFX_CBRS_REGULAR_TABS, AFX_CBRS_FLOAT | AFX_CBRS_RESIZE | AFX_CBRS_AUTOHIDE))
{
TRACE(_T("Failed to create Filter window\n"));
return FALSE; // failed to create
}
SetDockingWindowIcons(theApp.m_bHiColorIcons);
AddPane(&m_wndPane1);
m_wndPane1.EnableDocking(CBRS_ALIGN_LEFT | CBRS_ALIGN_RIGHT);
DockPane(&m_wndPane1);
return 0;
}
But when I try to drag the pane, I can drag it anywhere, left, right, up, down: https://postimg.cc/w7tDRsVL
which is not normal. I should can drag the panel only in left or right side.
I attached here a sample project: TestPane.zip
Last edited by mesajflaviu; March 29th, 2020 at 04:04 AM.
-
March 29th, 2020, 01:04 PM
#2
Re: Restrict CDockablePane to CBRS_ALIGN_LEFT or CBRS_ALIGN_RIGHT
Not sure it will work, however you could try to handle the WM_WINDOWPOSCHANGING message and depending on the current position allow or not the position changing.
Victor Nijegorodov
-
March 29th, 2020, 02:37 PM
#3
Re: Restrict CDockablePane to CBRS_ALIGN_LEFT or CBRS_ALIGN_RIGHT
Originally Posted by VictorN
Not sure it will work, however you could try to handle the WM_WINDOWPOSCHANGING message and depending on the current position allow or not the position changing.
I see, but then what is the point with those settings ? EnableDocking(CBRS_ALIGN_LEFT | CBRS_ALIGN_RIGHT)
-
March 30th, 2020, 01:31 AM
#4
Re: Restrict CDockablePane to CBRS_ALIGN_LEFT or CBRS_ALIGN_RIGHT
IMHO you mix "docking" and "floating". Don't you?
Victor Nijegorodov
-
March 30th, 2020, 04:29 AM
#5
Re: Restrict CDockablePane to CBRS_ALIGN_LEFT or CBRS_ALIGN_RIGHT
As long while I am in dragging state (floating) and I see the arrows for top and bottom direction, I can (and I succeed) to dock the panel in top or bottom position.
-
April 2nd, 2020, 01:22 AM
#6
Re: Restrict CDockablePane to CBRS_ALIGN_LEFT or CBRS_ALIGN_RIGHT
For those who have the same problem, I overridden DockPane method in order to solve my issue. Thank you for your support and your time.
-
April 2nd, 2020, 01:50 AM
#7
Re: Restrict CDockablePane to CBRS_ALIGN_LEFT or CBRS_ALIGN_RIGHT
Thank you for sharing the solution!
Victor Nijegorodov
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|