[wxPython-users] Scrollbar help with DynamicSashWindow
Danny Shevitz
shevitz at lanl.gov
Fri Mar 23 09:50:45 PDT 2007
Andrea,
thanks for the response. I think there are few differences between what I
am trying to do and what you
implemented. If I understand correctly:
1) You never actually change the size of the TreeCtrl, you change the sash
position to fit the TreeCtrl.
This doesn't work for me. In a DSW, the layout is fixed by the user. I
don't want to change the
sash positions. In addition, in a DSW there is no API for changing sash
positions even if that were
what I wanted to do.
2) In CalculateMaxItemSize, you actually calculate the size of the tree. My
trees are at least several
thousand nodes in size. I'm afraid that calculating the size will incur an
unacceptable overhead every
time I do anything to the tree. I was hoping there existed a fast wx API
for doing it, like GetBestSize(). Like
I said originally, GetBestSize seems to do the right thing, but it only
seems to do it once. If there were
a method like GetVirtualSize() that actually worked, I'd be done (It would
also make your sample code easier).
3) DSW is different than SplitterWindows in that if I understand correctly,
the SplitterWindow does not
have it's own scrollbars. The scrollbars you see in your example are the
tree scrollbars. For the DSW,
you need the scrollbars because they have the splitting widget. It's the
tree scrollbars I'm trying to prevent.
Robin suggested putting the tree in a panel in the DSW. That way you could
make the virtual size of the
tree/panel large enough that the tree scrollbars never appeared. The
problem I have is that I'm having trouble
figuring out how to size the tree/panel dynamically, to minimally encompass
the tree, and then let the DSW
scrollbars manage the scrolling.
thanks,
D
At 12:47 AM 3/23/2007 +0100, you wrote:
>Hi Danny,
>
>On 3/22/07, Danny Shevitz wrote:
>>Time for the next question. I have now put the TreeCtrl in a Panel. The
>>size of the TreeCtrl is fixed, and the panel
>>is sized to fit. The problem is that the trees can grow arbitrarily large.
>>Is there a way to dynamically resize the
>>tree/panel so that the tree fits itself without it's own scrollbar. I tried
>>looking at
>>GetVirtualSize, GetBestSize,GetBestVirtualSize,GetEffectiveMinSize, etc.for
>>the tree to find what
>>virtual size it should be, but none of these methods seem to work.
>>
>>In summary, is there a dynamic way to find the virtual size of the tree, so
>>that I can update the physical size
>>to always be the same size? Would I need to re-Fit the Panel after this
>>operation?
>
>If I understand your question correctly, you could try the attached
>file. Every time you expand/collapse a node, if the size of the
>longest item does not fit (or it has too much space), the treectrl is
>resized accordingly to avoid the horizontal scrollbars. The attached
>file uses a splitterwindow to place the treectrl but it should be
>trivial to use a panel + sizer + treectrl.
>And, yes, try to call sizer.Layout() or panel.Layout() or
>yourframe.SendSizeEvent() (as a last resource) to layout your
>panel/tree configuration.
>
>Hope this helps.
>
>Andrea.
>
>"Imagination Is The Only Weapon In The War Against Reality."
>http://xoomer.virgilio.it/infinity77/
>
>
>Content-Type: text/plain; name="prova74.py"
>Content-Disposition: attachment; filename="prova74.py"
>X-Attachment-Id: f_ezlusqsn
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
>For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org
More information about the wxpython-users
mailing list