wxSashLayoutWindow 5 sashes

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:

wxSashLayoutWindow 5 sashes

Post 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 1362 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;
User avatar
shawnhcorey
Knows some wx things
Knows some wx things
Posts: 41
Joined: Mon Nov 19, 2012 3:29 pm
Location: The Great White North

Re: wxSashLayoutWindow 5 sashes

Post 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.
WARNING: Highly caffeinated ☕. Approach with caution 🚧.
pvn
Earned some good credits
Earned some good credits
Posts: 105
Joined: Mon Dec 26, 2016 5:21 am
Contact:

Re: wxSashLayoutWindow 5 sashes

Post 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
User avatar
shawnhcorey
Knows some wx things
Knows some wx things
Posts: 41
Joined: Mon Nov 19, 2012 3:29 pm
Location: The Great White North

Re: wxSashLayoutWindow 5 sashes

Post 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.
WARNING: Highly caffeinated ☕. Approach with caution 🚧.
pvn
Earned some good credits
Earned some good credits
Posts: 105
Joined: Mon Dec 26, 2016 5:21 am
Contact:

Re: wxSashLayoutWindow 5 sashes

Post 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?
Post Reply