[wxMac 2.8x] wxWindow::DoGetBestSize bug still not solved
Robin Dunn
robin at alldunn.com
Fri Apr 13 16:32:08 PDT 2007
H wrote:
> In article <461FBB82.3040604 at alldunn.com>,
> robin at alldunn.com (Robin Dunn) wrote:
>> Which window's best size is the problem for you? The tree? The
>> treebook? Each of these have their own DoGetBestSize method.
>
> The tree's window is the problem. You can see the bug when running the
> notebook sample. Choose the treebook and you will see that the tree's
> window is not correctly sized. The root of the bug is
> wxWindow::DoGetBestSize returning (0, 0) instead of taking the
> scrollbars into account when initializing/determining the initial size
> of the tree's window.
Uh, I don't think so. As I said wxTreeCtrl has it's own DoGetBestSize,
so the one in wxWindowBase will never be called for it. Also, a
treectrl with no items will not need to display the scrollbars anyway.
I do notice that InvalidateBestSize is not being called when new items
are being added to the tree however, but that is a separate issue...
Here is a quicky PyCrust session to show that a treectrl never has a 0,0
best size, and that it adapts when there is content added:
PyCrust 0.9.5 - The Flakiest Python Shell
Python 2.5 (r25:51918, Sep 19 2006, 08:49:13)
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
>>> wx.VERSION
(2, 8, 3, 0, '')
>>>
>>> t = wx.TreeCtrl(shell)
>>> t.GetBestSize()
wx.Size(10, 10)
>>> t.InvalidateBestSize()
>>> r = t.AddRoot("Root Item")
>>> i = t.AppendItem(r, "child item")
>>> t.GetBestSize()
wx.Size(100, 30)
>>>
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wx-users
mailing list