rrashedi
asked on
How to disable dialogbar from floating?
I have a dialogbar that is allowed to be docked either to the top or bottom of the frame window. However, I would like to disable it from floating. How?
ASKER
Thanks for your comment.
Unfortunately, the CMyBar::OnMove() is never executed when the bar is dragged from its docked position. I think when the bar is floating the CMiniFrameWnd::OnMove is called instead.
Hmm, the test program I threw off worked fine. Are you sure you have an ON_WM_MOVE in the message map? Or maybe the window is a child window of the actual docking window?
ASKER
Yes, the OnMove() implementation works. It is getting called properly when the bar is docked. But as soon as the bar becomes a floating bar, it is no longer accessed. I've verified this by placing a breakpoint and stepping through the code in debug mode.
Odd. Is your bar derived from CControlBar? Also, CBRS_FLOAT_MULTI should not be set in the EnableDocking call (I'm fairly certain that is not the default, though).
ASKER
It is derived from CDialogBar class. It is EnabledDocked
with CBRS_ALIGN_TOP|CBRS_ALIGN_
CMyBar->EnableDocking(CBRS
Well, CDialogBar, when floated suddenly has the stye 0xcdcdcdcd which means the memory was not initialized. This, of course, makes it CBRS_FLOAT_MULTI but I can't tell why.
I think I remember seeing something like this before, I just can't remember what does it, or why it is only at line 417 in DOCKCONT.CPP.
Let me think about it. maybe I'll remember what caused that.
I think I remember seeing something like this before, I just can't remember what does it, or why it is only at line 417 in DOCKCONT.CPP.
Let me think about it. maybe I'll remember what caused that.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It works great. Thanks for your assistance.
void CMyBar::OnMove(int x, int y)
{
CDialogBar::OnMove(x, y);
if (IsFloating())
AfxGetMainWnd()->PostMessa
}
then, in the main frame, catch the WM_USER message and call
LRESULT CMainFrame::OnUserMessage(
{
DockControlBar((CMyBar*)lP
return 0;
}
And the bar is still dragable between docking points, but auto-redocks to the last position if the user tries to float it.