-
March 13th, 2008, 12:40 PM
#1
How can I determine where my CControlBar is now docked?
I want to know on which side my CControlBar is docked.
Please help!
Mike
-
March 14th, 2008, 05:25 AM
#2
Re: How can I determine where my CControlBar is now docked?
Try CFrameWnd::GetDockState
Victor Nijegorodov
-
March 17th, 2008, 12:05 PM
#3
Re: How can I determine where my CControlBar is now docked?
CFrameWnd::GetDockState saves the status in the registry, but I want to save it at a different place!
-
March 17th, 2008, 12:25 PM
#4
Re: How can I determine where my CControlBar is now docked?
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!
Victor Nijegorodov
-
March 17th, 2008, 01:07 PM
#5
Re: How can I determine where my CControlBar is now docked?
Ok, but what can I do with CDockState? There is only LoadState(), SaveState() and GetVersion() as memberfunctions.
-
March 17th, 2008, 01:52 PM
#6
Re: How can I determine where my CControlBar is now docked?
And would you like?
Your OP sounds:
Originally Posted by mike_mc1
I want to know on which side my CControlBar is docked
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.
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.
Victor Nijegorodov
-
March 19th, 2008, 11:19 AM
#7
Re: How can I determine where my CControlBar is now docked?
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.
Last edited by mike_mc1; March 19th, 2008 at 11:37 AM.
-
March 19th, 2008, 04:01 PM
#8
Re: How can I determine where my CControlBar is now docked?
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
}
}
}
}
-
March 20th, 2008, 10:17 AM
#9
Re: How can I determine where my CControlBar is now docked?
OK thx! But with this code i know only the docking side, but not the exactly last position of the CControlBar.
-
March 20th, 2008, 10:43 AM
#10
Re: How can I determine where my CControlBar is now docked?
I already pointed out that the last bar position (the "most recent docked position") is saved in CControlBarInfo::m_rectMRUDockPos member.
Victor Nijegorodov
-
March 20th, 2008, 12:00 PM
#11
Re: How can I determine where my CControlBar is now docked?
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.
-
March 20th, 2008, 04:07 PM
#12
Re: How can I determine where my CControlBar is now docked?
Well, in yor OP you asked about CControlBar ...
Now you ask about some other ("black box" for the most of us) class
Why don't you ask the author of this article?
Victor Nijegorodov
-
January 30th, 2014, 09:21 AM
#13
Re: How can I determine where my CControlBar is now docked?
Originally Posted by VictorN
I already pointed out that the last bar position (the "most recent docked position") is saved in CControlBarInfo::m_rectMRUDockPos member.
my code say always m_rectMRUDockPos==CRect(0,0,0.0) for all my toolbars?
Andy ideas, why?
-
February 6th, 2014, 04:23 AM
#14
Re: How can I determine where my CControlBar is now docked?
How did you find out that
Originally Posted by Ralf Schneider
code say always m_rectMRUDockPos==CRect(0,0,0.0) for all my toolbars
How does your code look like?
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
|