My problem is the inverse of Notepad or Emacs.
Instead of a available (scratch) work area when I call the application, I want that the user explicitly opens a new work area so it can be displayed.
In my case, I have a menu bar, and a tool bar that I want to be displayed when I run the application.
And I have a tab bar (wxNotebook) with a panel for each tab.
each panel have a list view.
The problem that I have is that when I construct everything and show it all (like on notepad) it works. But if I show first only the menu bar and the tool bar, and the tab bar only when the user requests it, it doesn't works! It only appears a small box bellow the toolbar instead of the tab bar.
Add to the interface after shown Topic is solved
Only Fit helps a little
I tried everything you told but only Fit on the tab bar does something. The problem is that doesn't fill the all area.
I'll post some code.
First it sizes the toolbar and the panel where the tab bar will sit and shows it:
Then, at user request fills the work area:
I'll post some code.
First it sizes the toolbar and the panel where the tab bar will sit and shows it:
Code: Select all
...
resourcepanel = new wxPanel(this, wxID_ANY);
vbox->Add(resourcepanel, 1, wxEXPAND);
SetSizer(vbox);
Centre();
Show(true);
Then, at user request fills the work area:
Code: Select all
nb = new wxNotebook(resourcepanel, wxID_ANY);
wxPanel *lpanel = new wxPanel(nb,wxID_ANY);
wxPanel *mpanel = new wxPanel(nb,wxID_ANY);
wxPanel *spanel = new wxPanel(nb,wxID_ANY);
lv1 = new wxListView(lpanel,ID_LISTVIEW1,wxDefaultPosition,wxDefaultSize,wxLC_REPORT);
lv2 = new wxListView(mpanel,ID_LISTVIEW2,wxDefaultPosition,wxDefaultSize,wxLC_REPORT);
lv3 = new wxListView(spanel,ID_LISTVIEW3,wxDefaultPosition,wxDefaultSize,wxLC_REPORT);
nb->AddPage(lpanel,wxT("L"));
nb->AddPage(mpanel,wxT("M"));
nb->AddPage(spanel,wxT("S"));
wxBoxSizer *vbox2 = new wxBoxSizer(wxHORIZONTAL);
vbox2->Add(nb,1, wxEXPAND);
resourcepanel->SetSizer(vbox2);
wxBoxSizer *vboxl = new wxBoxSizer(wxVERTICAL);
vboxl->Add(lv1,1, wxEXPAND);
lpanel->SetSizer(vboxl);
wxBoxSizer *vboxm = new wxBoxSizer(wxVERTICAL);
vboxm->Add(lv2,1, wxEXPAND);
mpanel->SetSizer(vboxm);
wxBoxSizer *vboxs = new wxBoxSizer(wxVERTICAL);
vboxs->Add(lv3,1, wxEXPAND);
spanel->SetSizer(vboxs);
//With fit I see the contents of the tab bar but it doesn't occupy all available area
nb->Fit();
-
- Experienced Solver
- Posts: 70
- Joined: Fri Nov 07, 2008 4:25 pm
- Location: Saint-Petersburg, Russia
First of all, you shouldn't call Fit() at all, as it fits notebook to its contents, not contents to notebook.
Now, why not use resourcepanel->GetClientSize()?
Try this:
Now, why not use resourcepanel->GetClientSize()?
Try this:
Code: Select all
wxBoxSizer *vbox2 = new wxBoxSizer(wxVERTICAL);
resourcepanel->SetSizer(vbox2);
wxNotebook* nb = new wxNotebook(resourcepanel, wxID_ANY, wxDefaultPosition, resourcepanel->GetClientSize());
vbox2->Add(nb,1, wxEXPAND);
wxPanel *lpanel = new wxPanel(nb,wxID_ANY);
wxBoxSizer *vboxl = new wxBoxSizer(wxVERTICAL);
lpanel->SetSizer(vboxl);
wxPanel *mpanel = new wxPanel(nb,wxID_ANY);
wxBoxSizer *vboxm = new wxBoxSizer(wxVERTICAL);
mpanel->SetSizer(vboxm);
wxPanel *spanel = new wxPanel(nb,wxID_ANY);
wxBoxSizer *vboxs = new wxBoxSizer(wxVERTICAL);
spanel->SetSizer(vboxs);
wxListView* lv1 = new wxListView(lpanel,ID_LISTVIEW1,wxDefaultPosition,wxDefaultSize,wxLC_REPORT);
wxListView* lv2 = new wxListView(mpanel,ID_LISTVIEW2,wxDefaultPosition,wxDefaultSize,wxLC_REPORT);
wxListView* lv3 = new wxListView(spanel,ID_LISTVIEW3,wxDefaultPosition,wxDefaultSize,wxLC_REPORT);
vboxl->Add(lv1,1, wxEXPAND);
vboxm->Add(lv2,1, wxEXPAND);
vboxs->Add(lv3,1, wxEXPAND);
nb->AddPage(lpanel,wxT("L"));
nb->AddPage(mpanel,wxT("M"));
nb->AddPage(spanel,wxT("S"));
win xp pro sp3/VS Express 2008/MinGW;
win Vista Ultimate/VS 2005;
Debian Lenny/gcc/cegcc-mingw32ce;
wxWidgets-2.8.9 w/wxWinCE;
win Vista Ultimate/VS 2005;
Debian Lenny/gcc/cegcc-mingw32ce;
wxWidgets-2.8.9 w/wxWinCE;