I want to know on which side my CControlBar is docked.
Please help!
Mike
Printable View
I want to know on which side my CControlBar is docked.
Please help!
Mike
Try CFrameWnd::GetDockState
CFrameWnd::GetDockState saves the status in the registry, but I want to save it at a different place!
No! It is CFrameWnd::SaveBarState that "saves the status in the registry".
And CFrameWnd::GetDockState stores state information about the frame window's control bars in a CDockState object you are passing in it! :wave:
Ok, but what can I do with CDockState? There is only LoadState(), SaveState() and GetVersion() as memberfunctions.
And would you like? :confused:
Your OP sounds:So the CFrameWnd::GetDockState gives you the CDockState object, CDockState::m_arrBarInfo contains pointers to the stored control bar information (CControlBarInfo) for each control bar and the CRect CControlBarInfo::m_rectMRUDockPos is the "most recent docked position" of the toolbar.Quote:
Originally Posted by mike_mc1
But if you only want to save toolbar data at a different place than the CFrameWnd::SaveBarState does then your task is more simple! You could either use CDockState methods or develop your own ones + CFrameWnd::GetDockState/SetDockState to get/set the dock state data.
I have no documentation found in the msdn for CControlBarInfo. So I really don't know how to access to the interesting data for me and to write my own CFrameWnd::GetDockState/SetDockState.
Try this:
Code:CDockState state;
GetDockState(state);
for (INT i=0; i < state.m_arrBarInfo.GetSize(); i++) {
CControlBarInfo* pInfo = (CControlBarInfo*)state.m_arrBarInfo[i];
for (INT j=0; j < pInfo->m_arrBarID.GetSize(); j++) {
if(pInfo->m_arrBarID[j] == MY_BAR_ID) {
switch(pInfo->m_nBarID) {
case AFX_IDW_DOCKBAR_LEFT: break; // docked on left side
case AFX_IDW_DOCKBAR_RIGHT: break; // docked on right side
case AFX_IDW_DOCKBAR_TOP: break; // docked on top side
case AFX_IDW_DOCKBAR_BOTTOM: break; // docked on bottom side
}
}
}
}
OK thx! But with this code i know only the docking side, but not the exactly last position of the CControlBar.
I already pointed out that the last bar position (the "most recent docked position") is saved in CControlBarInfo::m_rectMRUDockPos member.
Thx again!
But I am using CSizingControlBar http://www.codeproject.com/KB/toolbars/sizecbar.aspx
When the user dock the CSizingControlBar I can use 'm_rectMRUDockPos', but after the user is changing the size, this values are not usefull.
Well, in yor OP you asked about CControlBar ...
Now you ask about some other ("black box" for the most of us) class :confused:
Why don't you ask the author of this article?
How did you find out thatHow does your code look like?Quote:
Originally Posted by Ralf Schneider