Cardlayout in wxWidgets. How?

Oct 20, 2013 at 12:07am
Hello. I am beginning to learn wxWidgets (on Code::Blocks). What I intend to do is to have an application with several panels that include multiple components on each of them (buttons, textboxes, etc.). I should be able to switch from panel to panel using buttons on the toolbar. I used to do it in Java using Cardlayout. Not clear how I can do it in wxWidgets given that Cardlayout is not existent there. I have searched it. Found a hint that it could be done with sizer but there is no clear explanation how sizer can help in this situation.

You advice is much appreciated!

Thanks!

Igor
Oct 20, 2013 at 1:44am
I think what you're looking for is wxNotebook.
http://docs.wxwidgets.org/2.8/wx_wxnotebook.html
Oct 20, 2013 at 2:01pm
admkrk.

Thanks. I was looking at that option but I did not like having those tabs. Not sure if wxNotebook can be done without tabs.

This is the structure that I have now:
1
2
3
4
5
6
wxFrame
  wxBoxSizer:BoxSizer1
    wxPanel: Panel1
       wxBoxSizer:BoxSizer2
    wxPanel:Panel2
       wxBoxSizer:BoxSizer3


This code does not do anything:

1
2
3
4
5
void DispGUIFrame::OnToolBarItem1Clicked1(wxCommandEvent& event)
{
    BoxSizer1->Hide(BoxSizer2, bool recursive = false);
    BoxSizer1->Layout();
}


Best.
Oct 20, 2013 at 5:30pm
No I'm pretty sure you need the tabs. I'm not positive about what you are looking for, but I think you can use wxAuiManager to get something that works with a toolbar?
http://docs.wxwidgets.org/2.8/wx_wxauimanager.html

Or you could try just using dialogs.
Oct 21, 2013 at 2:23am
admkrk.

Many thanks. Indeed, Aui is kind of what I was looking for.

The problem now is that I am looking for explanation on how to disable/enable individual pages(panels) by a mouse event. Deselecting "Enabled" in Code::Blocks is useless.

Thanks a lot!
Oct 21, 2013 at 6:02am
I've never used Aui for anything yet so I can't help much as far as the rest of it goes. I do know that some things work and some don't depending on platform and that might the case you're seeing. If you dig through the docs or ask of wxWidgets forum you'll have better luck getting more answers.
Oct 21, 2013 at 10:33am
Thanks for your help!
Topic archived. No new replies allowed.