wxSplitterWindow and SetMinimumPaneSize

Experimenting with wxSplitterwindow's, I came across a problem setting
the minimum pane size of the second splitterWindow. Browsing google
didn't provide the possible answer. The situation is as follows:

wxSplitterWindow_1 (vertical)
  wxPanel_1
    Sizer
      wxTreeCtrl
  wxPanel_2
    Sizer
      wxSplitterWindow_2 (horizontal)
          wxPanel_3
            Sizer
              wxPanel
                Sizer
                 wxButton's
              wxTreeListCtrl
          wxPanel_4
            Sizer
              wxHtmlWindow

When I start the application, both splitterwindows are at their
minimal size. Dragging the sashes work as expected.
When I set the wxSplitterWindow_1.SetMinimumPaneSize(150), the sash of
wxSplitterWindow_1 is located at the expected position. Setting
SetMinimumPaneSize(150) for wxSplitterWindow_2 has no effect other
then that the sash of wxSplitterWindow_2 completely disappears.

How can I set the MinimumPaneSize size of wxSplitterWindow_2 so that
it's possible to see the contents without dragging the sash?

Remy Cool

···

---------------------------
Code generated by wxGlade
---------------------------

class MyPanel3(wxPanel):
    def __init__(self, *args, **kwds):
        # begin wxGlade: MyPanel3.__init__
        kwds["style"] = wxTAB_TRAVERSAL
        wxPanel.__init__(self, *args, **kwds)
        self.window_6 = wxSplitterWindow(self, -1)
        self.window_6_pane_2 = wxPanel(self.window_6, -1)
        self.window_7 = wxSplitterWindow(self.window_6_pane_2, -1)
        self.window_7_pane_2 = wxPanel(self.window_7, -1)
        self.window_7_pane_1 = wxPanel(self.window_7, -1)
        self.window_6_pane_1 = wxPanel(self.window_6, -1)
        self.panel_5 = wxPanel(self, -1)
        self.btn_new = wxButton(self.panel_5, -1, "Newer")
        self.btn_reply = wxButton(self.panel_5, -1, "Reply")
        self.btn_forward = wxButton(self.panel_5, -1, "Forward")
        self.btn_save = wxButton(self.panel_5, -1, "Save")
        self.btn_print = wxButton(self.panel_5, -1, "Print")
        self.btn_exit = wxButton(self.panel_5, -1, "Exit")
        self.tree_ctrl_1 = wxTreeCtrl(self.window_6_pane_1, -1,
style=wxTR_HAS_BUTTONS|wxSUNKEN_BORDER)
        self.tree_ctrl_2 = wxTreeListCtrl(self.window_7_pane_1, -1)
        self.preview = wxHtmlWindow(self.window_7_pane_2, -1)

        self.__set_properties()
        self.__do_layout()
        # end wxGlade

    def __set_properties(self):
        # begin wxGlade: MyPanel3.__set_properties
        self.window_7.SplitHorizontally(self.window_7_pane_1,
self.window_7_pane_2)
        self.window_6.SplitVertically(self.window_6_pane_1,
self.window_6_pane_2)
        # end wxGlade

    def __do_layout(self):
        # begin wxGlade: MyPanel3.__do_layout
        grid_sizer_1 = wxFlexGridSizer(2, 1, 0, 0)
        sizer_16 = wxBoxSizer(wxVERTICAL)
        sizer_18 = wxBoxSizer(wxVERTICAL)
        sizer_17 = wxBoxSizer(wxVERTICAL)
        sizer_15 = wxBoxSizer(wxVERTICAL)
        sizer_1_copy_1_copy = wxBoxSizer(wxHORIZONTAL)
        sizer_1_copy_1_copy.Add(self.btn_new, 0, wxALL, 5)
        sizer_1_copy_1_copy.Add(self.btn_reply, 0,
wxRIGHT>wxTOP>wxBOTTOM, 5)
        sizer_1_copy_1_copy.Add(self.btn_forward, 0,
wxRIGHT>wxTOP>wxBOTTOM, 5)
        sizer_1_copy_1_copy.Add(self.btn_save, 0,
wxRIGHT>wxTOP>wxBOTTOM, 5)
        sizer_1_copy_1_copy.Add(self.btn_print, 0,
wxRIGHT>wxTOP>wxBOTTOM, 5)
        sizer_1_copy_1_copy.Add(self.btn_exit, 0,
wxRIGHT>wxTOP>wxBOTTOM, 5)
        self.panel_5.SetAutoLayout(1)
        self.panel_5.SetSizer(sizer_1_copy_1_copy)
        sizer_1_copy_1_copy.Fit(self.panel_5)
        sizer_1_copy_1_copy.SetSizeHints(self.panel_5)
        grid_sizer_1.Add(self.panel_5, 1, wxEXPAND, 0)
        sizer_15.Add(self.tree_ctrl_1, 1, wxEXPAND, 0)
        self.window_6_pane_1.SetAutoLayout(1)
        self.window_6_pane_1.SetSizer(sizer_15)
        sizer_15.Fit(self.window_6_pane_1)
        sizer_15.SetSizeHints(self.window_6_pane_1)
        sizer_17.Add(self.tree_ctrl_2, 1, wxALL|wxEXPAND, 5)
        self.window_7_pane_1.SetAutoLayout(1)
        self.window_7_pane_1.SetSizer(sizer_17)
        sizer_17.Fit(self.window_7_pane_1)
        sizer_17.SetSizeHints(self.window_7_pane_1)
        sizer_18.Add(self.preview, 1, wxALL|wxEXPAND, 5)
        self.window_7_pane_2.SetAutoLayout(1)
        self.window_7_pane_2.SetSizer(sizer_18)
        sizer_18.Fit(self.window_7_pane_2)
        sizer_18.SetSizeHints(self.window_7_pane_2)
        sizer_16.Add(self.window_7, 1, wxEXPAND, 0)
        self.window_6_pane_2.SetAutoLayout(1)
        self.window_6_pane_2.SetSizer(sizer_16)
        sizer_16.Fit(self.window_6_pane_2)
        sizer_16.SetSizeHints(self.window_6_pane_2)
        grid_sizer_1.Add(self.window_6, 1, wxEXPAND, 0)
        self.SetAutoLayout(1)
        self.SetSizer(grid_sizer_1)
        grid_sizer_1.Fit(self)
        grid_sizer_1.SetSizeHints(self)
        grid_sizer_1.AddGrowableRow(1)
        grid_sizer_1.AddGrowableCol(0)
        # end wxGlade

Remy C. Cool wrote:

Experimenting with wxSplitterwindow's, I came across a problem setting the minimum pane size of the second splitterWindow. Browsing google didn't provide the possible answer. The situation is as follows:

wxSplitterWindow_1 (vertical)
  wxPanel_1
    Sizer
      wxTreeCtrl
  wxPanel_2
    Sizer
      wxSplitterWindow_2 (horizontal)
          wxPanel_3
            Sizer
              wxPanel
                Sizer
                 wxButton's wxTreeListCtrl
          wxPanel_4
            Sizer
              wxHtmlWindow

When I start the application, both splitterwindows are at their minimal size. Dragging the sashes work as expected.
When I set the wxSplitterWindow_1.SetMinimumPaneSize(150), the sash of wxSplitterWindow_1 is located at the expected position. Setting SetMinimumPaneSize(150) for wxSplitterWindow_2 has no effect other then that the sash of wxSplitterWindow_2 completely disappears.

How can I set the MinimumPaneSize size of wxSplitterWindow_2 so that it's possible to see the contents without dragging the sash?

It could be because at the time you call SetMinimumPaneSize that the window hasn't been shown yet and so the size is undefined. Try instead to give the initial sash position as the thrid parameter to the Split* call and then use wxCallAfter to invoke the SetMinimumPaneSize after the window has been shown and layout has happened and it has a defined size.

---------------------------
Code generated by wxGlade
---------------------------

Sorry, reading other people's code is hard enough without it being generated from a RAD tool. Sending code that is generated and also not providing a complete runnable app doesn't help much and so I don't waste time reading it.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Remy C. Cool wrote:
> Experimenting with wxSplitterwindow's, I came across a problem
> setting the minimum pane size of the second splitterWindow.
> Browsing google didn't provide the possible answer. The situation
> is as follows:
>
> wxSplitterWindow_1 (vertical)
> wxPanel_1
> Sizer
> wxTreeCtrl
> wxPanel_2
> Sizer
> wxSplitterWindow_2 (horizontal)
> wxPanel_3
> Sizer
> wxPanel
> Sizer
> wxButton's
> wxTreeListCtrl
> wxPanel_4
> Sizer
> wxHtmlWindow
>
> When I start the application, both splitterwindows are at their
> minimal size. Dragging the sashes work as expected.
> When I set the wxSplitterWindow_1.SetMinimumPaneSize(150), the
> sash of wxSplitterWindow_1 is located at the expected position.
> Setting SetMinimumPaneSize(150) for wxSplitterWindow_2 has no
> effect other then that the sash of wxSplitterWindow_2 completely
> disappears.
>
> How can I set the MinimumPaneSize size of wxSplitterWindow_2 so
> that it's possible to see the contents without dragging the sash?

It could be because at the time you call SetMinimumPaneSize that
the window hasn't been shown yet and so the size is undefined. Try
instead to give the initial sash position as the thrid parameter to
the Split* call and then use wxCallAfter to invoke the
SetMinimumPaneSize after the window has been shown and layout has
happened and it has a defined size.

Thanx, I'll give that a try.

> ---------------------------
> Code generated by wxGlade
> ---------------------------

Sorry, reading other people's code is hard enough without it being
generated from a RAD tool. Sending code that is generated and also
not providing a complete runnable app doesn't help much and so I
don't waste time reading it.

Can't blame you. I only oncluded the code to prevent relpy's asking
for the code :slight_smile:

···

On Tuesday 04 November 2003 01:27, Robin Dunn wrote: