[wxPython] wxSplitterWindow::ReplaceWindow

We are trying to use

wxSplitterWindow::ReplaceWindow or
wxSplitterWindow::Unsplit / wxSplitterWindow::SplitVertically

to change window in the right part of a split window (toggling between two windows).

Creation and initiation of the windows is as below:

        # Create a SplitterWindow on the Main frame
        this.split = wxSplitterWindow(this, wxID_WXFRAME1SPLITTERWINDOW1, wxDefaultPosition, wxDefaultSize, wxSP_3D)

        # Create Tree View
        this.treeView = TreeView(this.split) # TreeView is a wxTreeCtrl

        # Create layout views
  this.layout1 = LayoutView(this.split) # LayoutView is a wxScrolledWindow
  this.layout2 = LayoutView(this.split)

        # Split
        this.split.SplitVertically(this.treeView, this.layout1 , 200)

At use of ReplaceWindow as below:

        this.split.ReplaceWindow(this.split.GetWindow2(), this.layout2)

the windows(this.layout1,this.layout2) seems to lay on top of each other,
the second window(this.layout2) is displayed
but all mouse events seems to be handled by the first window(this.layout1).

Also, at Refresh(checked with debugger), doDraw is first called twice for the first window(this.layout1)
and then once for the second window(this.layout2)

At use of Unsplit / SplitVertically (instead of ReplaceWindow) as below:

        this.split.Unsplit(this.split.GetWindow2())
        this.split.SplitVertically(this.treeView, this.layout2, 200)

All works fine, but when we want to change back to the first window(this.layout1) as below:

        this.split.Unsplit(this.split.GetWindow2())
        this.split.SplitVertically(this.treeView, this.layout1, 200)

nothing is shown in the right part of the split.
Also, at Refresh(checked with debugger), doDraw is never called for either window(this.layout1,this.layout2).

Shouldn't ReplaceWindow work exactly as Unsplit combined with SplitVertically ?

and what do we do wrong since we can't make it work in either case ? (bugg in wxPython ?)

thanks

Freyland Manne wrote:

We are trying to use

wxSplitterWindow::ReplaceWindow or
wxSplitterWindow::Unsplit / wxSplitterWindow::SplitVertically

to change window in the right part of a split window (toggling between two windows).

[...]

the windows(this.layout1,this.layout2) seems to lay on top of each other,
the second window(this.layout2) is displayed
but all mouse events seems to be handled by the first window(this.layout1).

You need to Hide() the window that you don't want shown in the splitter.

···

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