Re: Changing toolbar captions
"Ajay" <firstname.lastname@example.org> wrote in message
I am getting frustrated trying to change my toolbar captions (when the
decides he wants to see them in a different language)....
I dont exactly recall what I did but its not going to work the way you
are doing it. I remember doing GetParentFrame or something like that
(to get to CMiniDockFrame ??) and then changing the title. Run Spy++
to see the layout and then change the text of the parent. IIRC,
floating introduces another frame or something on those lines.<
Thanks Ajay. Brilliant!
The class is CMiniFrameWnd - one I hadn't come across before. You're spot
on: one of these is put round the toolbar when it is floated. Spy++ shows
me it, and after I have changed the CToolBar's caption, I can see the grey
area in the midddle is a window with the new caption, and what looks like
the frame is another window with the old caption!
More details are hard to find in the documentation. However
CControlBar::GetDockingFrame() is documented as returning a pointer to the
frame around a floating toolbar, so bingo! the following code does it:
CToolBar pWndToolBar = ...
pWndToolBar->SetWindowText( sCaption );
// Now if this is floating, it has an associated
// CMiniFrameWnd which has the caption bar. We
// need to change its text too.
// CControlBar::GetDockingFrame() is documented as
// giving the CMiniFrameWnd as long as the toolbar
// is floating. And so:
if( pWndToolBar->IsFloating() )
CFrameWnd *pWndFrame = pWndToolBar->GetDockingFrame();
if( pWndFrame ) pWndFrame->SetWindowText( sCaption );
Simple when you know how!
I do love this news group!
Author of 'Mozart the Music Processor'
For discussion/support see