I have an existing application. Within the frame a notebook is shown. Tabs are created by adding windows to the notebook.
The application has worked like this for some time.
Code: Select all
notebook_ = new wxNotebook(panel_, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize, wxCLIP_CHILDREN | wxBORDER_NONE);
wxSplitterWindow* splitter = new wxSplitterWindow(notebook_, wxID_ANY);
[Some code that add content to splitterwindow]
notebook_->AddPage(splitter, wxT(“name”));
Now I want some more space around the wxsplitterwindow within the notebook.
As wxnotebook can not handle sizers, I have to add another panel.
The new panel will be added to notebook. This new panel must have the notebook as parent.
The splitterwindow must now have new panel as parent, and not the notebook anymore.
Code: Select all
notebook_ = new wxNotebook(panel_, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize, wxCLIP_CHILDREN | wxBORDER_NONE);
ui::Panel* panel = new ui::Panel(notebook_, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
wxSplitterWindow* splitter = new wxSplitterWindow(panel, wxID_ANY);
[Some code that add content to splitterwindow]
wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
sizer->Add(splitter, 1, wxEXPAND | wxALL, 30);
panel->SetSizerAndFit(sizer);
panel->SetBackgroundColour(*wxGREEN);
notebook_->AddPage(panel, wxT(“name”));
In the notebook I only see the green panel. There is no controls. The splitter window is not to be located anywhere.
If I cheat and add a control directly to the sizer it is visible.
sizer->Add(new wxButton(panel, wxID_ANY, wxT("Button in panel sizer")), 1, wxEXPAND | wxALL, 30);
Any hints/suggestions to what I did wrong?