Tree Control resizing inside a scrolled panel

Dear list members,

I have a problem with using Tree Control inside a panel or scrolled
panel. This is my layout.

ScrolledPanelAGAIN.pyw (2.55 KB)

···

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

header |

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

<Root> |
+-- Child |

....
+----------------------------------------+

(I have attached an image about what I am trying to do, from
Thunderbird. That is the exact interface I am trying to create for a
different application, though)

Now what is happening is the tree control is created with the
defaultsize but I want it to be sized to the width of the panel and
the remaining height of the panel. It _seems_ to work but during some
resizes it snaps back to the original default size.

Can someone please look at the attached code and see if something is
glaring in it because I have tried different things to get it to work?

Also, when I use treecontrol inside a scrolled panel, how can I make
the tree scrolling same as the scrolled panels scroll bars? I get both
scroll bars when the tree control is larger the visible size of the
scroll panel.

I would also appreciate any inputs on the implementation. At present I
have used a splitter window with the left splitter containing a
scrolled panel. The scrolled panel :
1. contains a custom panel that has the text "Folder", and a bitmap
button next to it for some options, both in a horizontal boxsizer
2. has the tree control is below the custom header, laid out in a
vertical boxsizer.

Is there any reason that sash windows must be used in place of
splitter windows to create a two-pane interface?

Thank you,
-Kartic
PS: The code attached is only for the tree resizing part but is
adapted from the scrolled panel demo code.

K K wrote:

Dear list members,

I have a problem with using Tree Control inside a panel or scrolled
panel. This is my layout.

+----------------------------------------+
> header |
+----------------------------------------+
> <Root> |
> +-- Child |
....
+----------------------------------------+

(I have attached an image about what I am trying to do, from
Thunderbird. That is the exact interface I am trying to create for a
different application, though)

Now what is happening is the tree control is created with the
defaultsize but I want it to be sized to the width of the panel and
the remaining height of the panel. It _seems_ to work but during some
resizes it snaps back to the original default size.

You want to add the tree to the sizer like this:

         vbox.Add(tree, 1, wx.ALL|wx.EXPAND, 5)

and you don't wan to bind EVT_SIZE, otherwise the sizer will never get called to do its layout.

  > Also, when I use treecontrol inside a scrolled panel, how can I make

the tree scrolling same as the scrolled panels scroll bars? I get both
scroll bars when the tree control is larger the visible size of the
scroll panel.

That requires some dirty work in the C++ code to make it possible, and even then it doesn't work very well. There are some classes in the gizmos module (RemotelyScrolledTreeCtrl, etc.) that did things like this at one time, but they havn't been maintained for years so I don't know the current state of things.

Is there any reason that sash windows must be used in place of
splitter windows to create a two-pane interface?

No. If a splitter does what you need then use it.

···

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

You want to add the tree to the sizer like this:

         vbox.Add(tree, 1, wx.ALL|wx.EXPAND, 5)

Cool! That worked..thanks a lot. (I tried with the second argument as
0 and that did not work.)

and you don't wan to bind EVT_SIZE, otherwise the sizer will never get
called to do its layout.

Oh okay. I did not know that about EVT_SIZE and sizer.

That requires some dirty work in the C++ code to make it possible, and
even then it doesn't work very well. There are some classes in the
gizmos module (RemotelyScrolledTreeCtrl, etc.) that did things like this
at one time, but they havn't been maintained for years so I don't know
the current state of things.

Just what I feared. Is this RemoteScolledTreeCtrl in the CVS repository?

Thanks,
-Kartic

···

On 6/14/05, Robin Dunn <robin@alldunn.com> wrote:

K K wrote:

···

On 6/14/05, Robin Dunn <robin@alldunn.com> wrote:

That requires some dirty work in the C++ code to make it possible, and
even then it doesn't work very well. There are some classes in the
gizmos module (RemotelyScrolledTreeCtrl, etc.) that did things like this
at one time, but they havn't been maintained for years so I don't know
the current state of things.

Just what I feared. Is this RemoteScolledTreeCtrl in the CVS repository?

Yep.

http://cvs.wxwidgets.org/viewcvs.cgi/wxWidgets/contrib/include/wx/gizmos/splittree.h
http://cvs.wxwidgets.org/viewcvs.cgi/wxWidgets/contrib/src/gizmos/splittree.cpp

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