[wxPython] Problems with wxSashLayoutWindow?

Hi. :slight_smile:

I'm trying to get my window layout working and can't seem to get it to
work. What I *want* is as follows:

···

+--------+-------------------------+

Window | Window B |
  A | |
       > >

+--------+-------------------------+

Window C |
                                 >
                                 >

+----------------------------------+

Window A starts out with a certain width, and fills vertically. Window C
starts out with a certain height, and fills horizontally. I want window B
to fill both horizontally and vertically -- whatever is left, is window B.

How I have it set up right now is a wxSashLayoutWindow for the 'top' (A
and B) and another for the bottom (C), with the top split in two. This
dosen't quite work, the sashes are odd, but more importantly, I can't get
window B to fill in the entire remaining-client.

Here's the code, which is basically modified from the demo, since the
docmentation wasn't very helpful :slight_smile:

----- SNIP -----
        win = wxSashLayoutWindow(self,wid.MW_TOP_PANE)
        win.SetDefaultSize(wxSize(1000,150))
        win.SetOrientation(wxLAYOUT_HORIZONTAL)
        win.SetAlignment(wxLAYOUT_TOP)
        win.SetBackgroundColour(wxColour(255,0,0))
        win.SetSashVisible(wxSASH_BOTTOM,true)
        self._top_pane = win

        win = wxSashLayoutWindow(self,wid.MW_MESSAGE_PANE)
        win.SetOrientation(wxLAYOUT_VERTICAL)
        win.SetDefaultSize(wxSize(1000,150))
        win.SetAlignment(wxLAYOUT_BOTTOM)
        win.SetBackgroundColour(wxColour(0,255,0))
        self._message_pane = win

        win = wxSashLayoutWindow(self._top_pane,wid.MW_BOXES_PANE)
        win.SetOrientation(wxLAYOUT_VERTICAL)
        win.SetDefaultSize(wxSize(100,1000))
        win.SetAlignment(wxLAYOUT_LEFT)
        win.SetBackgroundColour(wxColour(0,0,255))
        win.SetSashVisible(wxSASH_RIGHT,true)
        self._boxes_pane = win
        
        win = wxSashLayoutWindow(self._top_pane,wid.MW_MSGLIST_PANE)
        win.SetOrientation(wxLAYOUT_HORIZONTAL)
        win.SetAlignment(wxLAYOUT_RIGHT)
  win.SetDefaultSize(wxSize(1000,self._boxes_pane.GetSize().GetHeight()))
# -- The above is /trying/ to get it to fill out vertically too...
   win.SetBackgroundColour(wxColour(255,0,255))
        self._msglist_pane = win
        
    def OnSashDrag(self, event):
        if event.GetDragStatus() == wxSASH_STATUS_OUT_OF_RANGE:
            return

        eID = event.GetId()
        if eID == wid.MW_TOP_PANE:
            self._top_pane.SetDefaultSize(wxSize(1000,
event.GetDragRect().height))

        elif eID == wid.MW_BOXES_PANE:
    self._boxes_pane.SetDefaultSize(wxSize( \
      event.GetDragRect().width, 1000))

        elif eID == wid.MW_MSGLIST_PANE:
    self._msglist_pane.SetDefaultSize( \
      wxSize(1000,event.GetDragRect().height))

        elif eID == wid.MW_MESSAGE_PANE:
            self._message_pane.SetDefaultSize( \
    wxSize(1000,event.GetDragRect().height))

        wxLayoutAlgorithm().LayoutWindow(self)

    def OnSize(self, event):
        wxLayoutAlgorithm().LayoutWindow(self)

---- SNIP

Thanks for any help :slight_smile:

I'm trying to get my window layout working and can't seem to get it to
work. What I *want* is as follows:

+--------+-------------------------+
> Window | Window B |
> A | |
> > >
+--------+-------------------------+
> Window C |
> >
> >
+----------------------------------+

Window A starts out with a certain width, and fills vertically. Window C
starts out with a certain height, and fills horizontally. I want window B
to fill both horizontally and vertically -- whatever is left, is window B.

How I have it set up right now is a wxSashLayoutWindow for the 'top' (A
and B) and another for the bottom (C), with the top split in two. This
dosen't quite work, the sashes are odd, but more importantly, I can't get
window B to fill in the entire remaining-client.

I think you might be better off with using two nested wxSplitterWindows.
The outer splitter is split horizontally with another splitter and window C.
The inner spitter is split vertically with window A and window B. This
automatically fills out all the space in window B's area and your don't have
to worry about layout.

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com
http://wxpython.org Java give you jitters?
http://wxpros.com Relax with wxPython!