From: Robin Dunn Date: Tue, 27 Jan 2004 22:56:08 +0000 (+0000) Subject: Send an extra size event after creation to work around an apparent bug X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/a9092ede82057123a4fe4c5f758782a8c21b3728?ds=inline Send an extra size event after creation to work around an apparent bug in XP's ListView_GetViewRect git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25403 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/listbkg.cpp b/src/generic/listbkg.cpp index 676b202c93..3e8d09d7fb 100644 --- a/src/generic/listbkg.cpp +++ b/src/generic/listbkg.cpp @@ -57,7 +57,6 @@ const int wxID_LISTBOOKLISTVIEW = wxNewId(); BEGIN_EVENT_TABLE(wxListbook, wxBookCtrl) EVT_SIZE(wxListbook::OnSize) - EVT_LIST_ITEM_SELECTED(wxID_LISTBOOKLISTVIEW, wxListbook::OnListSelected) END_EVENT_TABLE() @@ -125,6 +124,16 @@ wxListbook::Create(wxWindow *parent, ); #endif // wxUSE_LINE_IN_LISTBOOK +#ifdef __WXMSW__ + // On XP with themes enabled the GetViewRect used in GetListSize to + // determine the space needed for the list view will incorrectly return + // (0,0,0,0) the first time. So send a pending event so OnSize wiull be + // called again after the window is ready to go. Technically we don't + // need to do this on non-XP windows, but if things are already sized + // correctly then nothing changes and so there is no harm. + wxSizeEvent evt; + GetEventHandler()->AddPendingEvent(evt); +#endif return true; }