How to show and hide wxToolbar

Milan Babuskov milanb at panonnet.net
Sat Feb 24 14:15:12 PST 2007


[wxGTK 2.8.0]

I'm trying to add an option to hide and show toolbar in my application. 
I first tried like this:

------------------------------------------------------------
void MainFrame::OnMenuToggleToolbar( wxCommandEvent& event )
{
     toolBar->Show(!toolBar->IsShown());
     Layout();
}
------------------------------------------------------------

Toolbar does get hidden and shown, but other controls don't resize. So I 
tried with "SendSizeEvent()" but it doesn't work either.

Then I tried like this:

------------------------------------------------------
if (GetToolBar())
     SetToolBar(0);
else
     SetToolBar(toolBar);
------------------------------------------------------

...it doesn't work. Finally I found a combination that does hide the 
toolbar properly:

------------------------------------------------------
if (GetToolBar())
{
     SetToolBar(0);
     toolBar->Show(false);
}
------------------------------------------------------


However, I'm unable to find the code that would return the toolbar and 
resize other controls. I tried this:

------------------------------------------------------
SetToolBar(toolBar);
toolBar->Show(true);
------------------------------------------------------

...but it doesn't work.


Any tips or things to try?


Thanks,

-- 
Milan Babuskov
http://www.guacosoft.com
http://www.flamerobin.org





More information about the wx-users mailing list