X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/69bc65e3f8462f63785d7daa656d4e0d573004d8..97873d0c03107863184665f8c43711d20bb0349d:/samples/toolbar/toolbar.cpp?ds=sidebyside diff --git a/samples/toolbar/toolbar.cpp b/samples/toolbar/toolbar.cpp index 9fc57c6030..7d0a678acd 100644 --- a/samples/toolbar/toolbar.cpp +++ b/samples/toolbar/toolbar.cpp @@ -627,6 +627,7 @@ MyFrame::MyFrame(wxFrame* parent, // Associate the menu bar with the frame SetMenuBar(menuBar); + menuBar->Check(IDM_TOOLBAR_TOGGLE_TOOLBAR, true); menuBar->Check(IDM_TOOLBAR_SHOW_BOTH, true); menuBar->Check(IDM_TOOLBAR_TOGGLETOOLTIPS, true); @@ -705,9 +706,11 @@ void MyFrame::OnToggleToolbar(wxCommandEvent& WXUNUSED(event)) } else { + // notice that there is no need to call SetToolBar(NULL) here (although + // this it is harmless to do and it must be called if you do not delete + // the toolbar but keep it for later reuse), just delete the toolbar + // directly and it will reset the associated frame toolbar pointer delete tbar; - - SetToolBar(NULL); } }