[ wxwindows-Bugs-1769664 ] 1.2 wxWindow - Layout() is not called
automatically
SourceForge.net
noreply at sourceforge.net
Tue Aug 7 14:32:55 PDT 2007
Bugs item #1769664, was opened at 2007-08-07 14:23
Message generated for change (Comment added) made by robind
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1769664&group_id=9863
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Common
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Andrey (andrey_yazhuk)
Assigned to: Nobody/Anonymous (nobody)
Summary: 1.2 wxWindow - Layout() is not called automatically
Initial Comment:
Current wxWidgets documentation for wxWindow::Layout() says "when auto layout is on, this function gets called automatically when the window is resized".
I overloaded Layout() in my class, if I derive the class from wxPanel, the function indeed gets called. If I derive the same class from wxWindow Layout() is not being called.
I examined the source code for ver 2.8.2 and found the following:
void wxPanel::OnSize(wxSizeEvent& event)
{
if (GetAutoLayout())
Layout();
...
}
There is nothing like that in wxWindow source code, it seems that auto layout works only for wxPanel-derived classes.
Julian Smart commented on this:
Layout() not getting called automatically - I've often been bitten by this myself, and in principle I agree, this should be implemented in wxWindow as per the documentation. However... I just tried implementing it in SVN trunk and it broke the layout of the rich text control sample (the listbox + combobox has a parent that's derived from wxControl, and this parent window implements OnSize and calls Layout()). So it would need a bit more investigation to see whether the change would break too many applications. Another issue is that wxPanel::OnSize calls event.Skip(), which would need to be removed if wxWindow::OnSize implemented the same thing (to avoid double-layout) - and this is another potential for incompatibility. I'll have another look into this.
----------------------------------------------------------------------
>Comment By: Robin Dunn (robind)
Date: 2007-08-07 14:32
Message:
Logged In: YES
user_id=53955
Originator: NO
This has been discussed a few times before and the reason that wxWindow
doesn't do auto-layout is because there are so many derived classes that
are not intended to be widget containers (such as all the controls) and it
was decided that wxWindow shouldn't impose this functionality on them. At
most this is a documentation bug, unless we decide to change this design.
It's easy to workaround of course, either switch your class to derive from
wxPanel, or give it a EVT_SIZE handler that calls Layout().
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1769664&group_id=9863
More information about the wx-dev
mailing list