Re: Changing toolbar captions
"Ajay" <ajaykalra@yahoo.com> wrote in message
news:2abfd7eb-d6b9-4c38-9d7b-2fbfa5430faa@n19g2000vba.googlegroups.com...
I am getting frustrated trying to change my toolbar captions (when the
user
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!
Dave
--
David Webber
Author of 'Mozart the Music Processor'
http://www.mozart.co.uk
For discussion/support see
http://www.mozart.co.uk/mozartists/mailinglist.htm