Page 1 of 1

wxSashLayoutWindow 5 sashes

Posted: Wed Feb 28, 2018 3:45 pm
by pvn
I have a MDI frame with 2 wxSashLayoutWindow shown in red and blue in the attached image
done with the code below

the red is aligned to the left and the blue to bottom
I want to do a new green in the image below the red and a new yellow at right of the red and on top of the blue

thanks

[img]
Untitled.png
Untitled.png (31.58 KiB) Viewed 1363 times
[/img]

this is the code for the red and blue

Code: Select all

int w, h;
  GetClientSize(&w, &h);
  wxSashInput* ws;
  ws = new wxSashInput(this, ID_WINDOW_SASH);
  ws->SetDefaultSize(wxSize(850, h));
  ws->SetOrientation(wxLAYOUT_VERTICAL);
  ws->SetAlignment(wxLAYOUT_LEFT);
  ws->SetSashVisible(wxSASH_RIGHT, true);
  ws->SetExtraBorderSize(10);
  ws->SetMinimumSizeX(300);
  ws->SetBackgroundColour(*wxRED);
  m_sash_connect = ws;

  wxSashLayoutWindow* win;
  win = new wxSashLayoutWindow(this, ID_WINDOW_LOG, wxDefaultPosition, wxDefaultSize,
    wxNO_BORDER | wxSW_3D | wxCLIP_CHILDREN);
  win->SetDefaultSize(wxSize(w, 100));
  win->SetOrientation(wxLAYOUT_HORIZONTAL);
  win->SetAlignment(wxLAYOUT_BOTTOM);
  win->SetSashVisible(wxSASH_TOP, true);
  win->SetExtraBorderSize(10);
  win->SetMinimumSizeX(100);
  win->SetBackgroundColour(*wxBLUE);
  m_sash_log = win;

Re: wxSashLayoutWindow 5 sashes

Posted: Wed Feb 28, 2018 4:05 pm
by shawnhcorey
Do you want to use wxSashWindow or wxSplitterWindow? The are completely different from each other. Most of the time, people would want wxSplitterWindow.

Re: wxSashLayoutWindow 5 sashes

Posted: Wed Feb 28, 2018 5:04 pm
by pvn
I don't care which class to use as long I get the desired layout in the picture

I tried many combinations of vertical/horizontal/left/right/top/bottom here but I don't seem to get how they align to each other

Code: Select all

ws->SetOrientation(wxLAYOUT_VERTICAL);
  ws->SetAlignment(wxLAYOUT_LEFT);
  ws->SetSashVisible(wxSASH_RIGHT, true);
one option could be use a split , then inside other split or sash

Re: wxSashLayoutWindow 5 sashes

Posted: Wed Feb 28, 2018 5:32 pm
by shawnhcorey
pvn wrote:I don't care which class to use as long I get the desired layout in the picture
Both will look the same but behave differently.

A wxSplitterWindow will divide a parent window into two subwindows with a control between them. When one grows, the other shrinks.

wxSashWindow place controls on any or all the sides of a subwindow. They only control the size of their widow; the other windows do not change size. It is possible to make a subwindow large enough so that other subwindows are push completely out of the parent window. I recommend that you always put your sash windows in a wxScrollWindow for this reason.

Also sash windows have similar abilities as wxAUI. You may want to consider that instead.

Re: wxSashLayoutWindow 5 sashes

Posted: Wed Feb 28, 2018 5:39 pm
by pvn
ok, thanks for the explanation. sash window it is

do you know how can I align the sash windows to each other so that it results in the picture layout?