|
-
September 21st, 2005, 09:27 AM
#1
Problem with change a toolbar main label
Hi All !
I want to change a text what is visible in toolbar when is flyable (this in toolbar label). So I call a method:
m_wndToolBar.SetWindowText("Ala ma kota");
But this not efect. I try several methods to update toolbar but I havn't result. I can only manually dock and undock toolbar - int this moment label is update.
Thnx in advance for any sugastions
Olekba
-
September 21st, 2005, 11:35 AM
#2
Re: Problem with change a toolbar main label
You should set the text not for the toolbar window but for its parent frame window (when toolbar is floating).
Try something like this (I am not 100% sure it will work cause I never did it myself) :
Code:
if ( m_wndToolBar.IsFloating() ) // only when we float
{
m_wndToolBar.GetParent()->GetParent()->SetWindowText("Ala ma kota");
}
And don't forget to check the return value for each GetParent() call to be not NULL!
-
September 21st, 2005, 11:37 AM
#3
Re: Problem with change a toolbar main label
A toolbar can have 2 states
- Docked - in this state, the toolbar is attached to one of the frame's edges and moves as the frame is moved. In this state, one cannot see the toolbar's titlebar ( which shows the text ), hence the text is not visible
- Floating - in this state, the toolbar is shown as a popup window with a title bar and in this state, the frame can be moved without the toolbar moving. In this state, you can see the title. I think this is what you mean by flyable, if I understand you right.
Now, what is your problem ? Are you trying to change the text and runtime and you see no effect ? However, this statement of yours seems to contradict that
 Originally Posted by olekba
I can only manually dock and undock toolbar - int this moment label is update.
Are you saying that when the toolbar is floating, and you change the text, it doesn't take effect immediately, but you have to dock and undock it to see the change ?
Please explain.
-
September 21st, 2005, 11:41 AM
#4
Re: Problem with change a toolbar main label
VictroN solution work !!! THNX Very Much
-
September 21st, 2005, 11:44 AM
#5
Re: Problem with change a toolbar main label
I see.. I think my guess was right..
Reason:
The toolbar control as such doesn't have a titlebar. It is a child window hosted inside a frame. When it is docked, the frame is the main frame window that you see. WHen it is floating, the title bar and all that that you see also is a frame and the toolbar is made a child of this popup frame window. The MFC class for this floating frame is CMiniDockFrameWnd. So the text that you see is actually the text of the CMiniDockFrameWnd object.
Solution:
Code:
if(m_wndToolBar.IsFloating())
{
m_wndToolBar.GetParentFrame()->SetWindowText(_T("New text"));
}
else
{
m_wndToolBar.SetWindowText(_T("New text"));
}
-
September 21st, 2005, 11:45 AM
#6
Re: Problem with change a toolbar main label
oopps.. I just repeated what VictorN said
-
September 21st, 2005, 11:48 AM
#7
Re: Problem with change a toolbar main label
 Originally Posted by kirants
oopps.. I just repeated what VictorN said 
... but more clearly!
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
|