[wxPython-dev] wxPython preview build

Robin Dunn robin at alldunn.com
Thu May 3 10:26:17 PDT 2007


Andrea Gavana wrote:
> Hi Robin,
> 
>    maybe you already explained it somewhere, but in running the
> SizedControls demo I still get those warnings:
> 
> Debug: ..\..\include\wx/msw/private.h(338): 'GetWindowRect' failed
> with error 0x00000578 (invalid window handle.).

This is happening because the child widgets are being added to the sizer 
from within the panel's overridden AddChild method, and the sizer Add 
results in a call to the GetWindowRect API, but the widget's window 
handle hasn't yet been set in the wx C++ class.

Kevin, can you think of a way to defer the sizer parts of AddChild until 
after the child widget is fully constructed?  I'm hesitant to suggest 
using wx.CallAfter because that might be too late for some situations... 
  The other alternative is to change wx to not call parent->AddChild 
until after it has created the native widget, but there are a lot of 
places that would have to be changed, and would likely introduce more 
problems.

We can also just suppress the log message during the sizer.Add(), but 
that is just a band-aide solution that covers the real issue.

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





More information about the wxpython-dev mailing list