[wxMac 2.8x] wxWindow::DoGetBestSize bug still not solved
H
H at h.com
Sat Apr 14 04:23:53 PDT 2007
In article <462012F8.7010800 at alldunn.com>,
robin at alldunn.com (Robin Dunn) wrote:
> 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)
> >>>
Hi Robin,
please debug the notebook sample and you will see that
wxWindowBase::DoGetBestSize() will be called. I do not know what Python
does but C++ definitely calls it. Here is the stack trace:
#0 0x00029d60 in wxWindowBase::DoGetBestSize at wincmn.cpp:496
#1 0x0001a7a0 in wxWindow::DoGetBestSize at window.cpp:1908
#2 0x001428ec in wxTreeCtrlBase::DoGetBestSize at treebase.cpp:172
#3 0x00151794 in wxGenericTreeCtrl::DoGetBestSize at treectlg.cpp:3657
#4 0x0027fa78 in wxWindowBase::GetBestSize at window.h:336
#5 0x000221a0 in wxWindowBase::GetEffectiveMinSize at wincmn.cpp:693
#6 0x0002226c in wxWindowBase::SetInitialSize at wincmn.cpp:708
#7 0x0014506c in wxGenericTreeCtrl::Create at treectlg.cpp:855
#8 0x0029c6a8 in wxGenericTreeCtrl::wxGenericTreeCtrl at treectlg.h:56
#9 0x0029c804 in wxTreeCtrl::wxTreeCtrl at treectlg.h:375
#10 0x00057430 in wxTreebook::Create at treebkg.cpp:120
#11 0x002839b0 in wxTreebook::wxTreebook at treebook.h:53
#12 0x0000600c in MyFrame::RecreateBook at notebook.cpp:436
#13 0x0000a730 in MyFrame::OnType at notebook.cpp:611
#14 0x0000fb00 in wxAppConsole::HandleEvent at appbase.cpp:320
#15 0x0006562c in wxEvtHandler::ProcessEventIfMatches at event.cpp:1203
#16 0x00065c64 in wxEventHashTable::HandleEvent at event.cpp:877
#17 0x0006754c in wxEvtHandler::ProcessEvent at event.cpp:1265
#18 0x00040554 in wxMenuBase::SendEvent at menucmn.cpp:769
#19 0x000209a0 in wxMacWindowCommandEventHandler at window.cpp:575
#20 0x00021c90 in wxMacWindowEventHandler at window.cpp:658
#21 0x9329a934 in DispatchEventToHandlers
#22 0x9329a08c in SendEventToEventTargetInternal
#23 0x932a0e90 in SendEventToEventTarget
#24 0x933197e8 in SendHICommandEvent
#25 0x93349694 in SendMenuItemSelectedEvent
#26 0x9334959c in FinishMenuSelection
#27 0x93330a48 in MenuSelectCore
#28 0x93330530 in MenuSelect
#29 0x0008f57c in wxMacTopLevelMouseEventHandler at toplevel.cpp:557
#30 0x000983bc in wxMacAppEventHandler at app.cpp:702
#31 0x9329a934 in DispatchEventToHandlers
#32 0x9329a08c in SendEventToEventTargetInternal
#33 0x932a0e90 in SendEventToEventTarget
#34 0x934903f0 in HandleMouseEvent
#35 0x932a11fc in ToolboxEventDispatcherHandler
#36 0x9329ab84 in DispatchEventToHandlers
#37 0x9329a08c in SendEventToEventTargetInternal
#38 0x932a0e90 in SendEventToEventTarget
#39 0x00095ff4 in wxApp::MacHandleOneEvent at app.cpp:1248
#40 0x00096118 in wxApp::MacDoOneEvent at app.cpp:1217
#41 0x0019d7a4 in wxEventLoop::Dispatch at evtloop.cpp:107
#42 0x0019d3c0 in wxEventLoopManual::Run at evtloopcmn.cpp:98
#43 0x000aa6b8 in wxAppBase::MainLoop at appcmn.cpp:308
#44 0x000aa9d0 in wxAppBase::OnRun at appcmn.cpp:363
#45 0x0002d820 in wxEntry at init.cpp:440
#46 0x00003df0 in main at notebook.cpp:33
Hartwig
More information about the wx-users
mailing list