3 panes with 2 splitters

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
pvn
Earned some good credits
Earned some good credits
Posts: 105
Joined: Mon Dec 26, 2016 5:21 am
Contact:

3 panes with 2 splitters

Post by pvn »

I am using
https://docs.wxwidgets.org/3.0/classwx_ ... indow.html

to divide a frame into 3 equal size panes

But I don't quite get the desired result with these parameters below in

Code: Select all

splitter_1->SetMinSize(wxSize(1000, -1));
splitter_2->SplitVertically(panel_2, panel_3, 700);
complete code

where

Code: Select all

size_t panel_size = rect.GetWidth() / 3;
is an attempt to get 1/3 of the window display size

Code: Select all

wxFrameTrader::wxFrameTrader(const wxString& title)
  : wxFrame(NULL, wxID_ANY, title)
{
  wxDisplay display(wxDisplay::GetFromWindow(this));
  wxRect rect = display.GetClientArea();
  size_t panel_size = rect.GetWidth() / 3;

  wxSplitterWindow* splitter_1 = new wxSplitterWindow(this);
  splitter_1->SetSashInvisible(true);
  splitter_1->SetMinSize(wxSize(1000, -1));
  wxPanel* panel_1 = new wxPanel(splitter_1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDOUBLE_BORDER);
  panel_1->SetBackgroundColour(wxColour(128, 0, 0));

  wxSplitterWindow* splitter_2 = new wxSplitterWindow(splitter_1);
  splitter_2->SetSashInvisible(true);
  splitter_2->SetMinSize(wxSize(2000, -1));
  wxPanel* panel_2 = new wxPanel(splitter_2, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDOUBLE_BORDER);
  panel_2->SetBackgroundColour(wxColour(0, 128, 0));
  wxPanel* panel_3 = new wxPanel(splitter_2, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDOUBLE_BORDER);
  panel_3->SetBackgroundColour(wxColour(0, 0, 128));

  splitter_1->SplitVertically(splitter_2, panel_1, 0);
  splitter_2->SplitVertically(panel_2, panel_3, 700);
}
the attached image shows the result
Untitled.png
Untitled.png (54.25 KiB) Viewed 71813 times
Post Reply