From bc4382a9dd5d202008320f7a86718381b7144bda Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 18 Oct 2015 03:55:32 +0200 Subject: [PATCH] Run wxListbook::OnSize() after creation under all platforms This was previously done only for wxMSW but is also necessary for wxOSX to ensure that the icons in the list view part are arranged and shown correctly initially, otherwise the selected item could be only partially visible. --- src/generic/listbkg.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/generic/listbkg.cpp b/src/generic/listbkg.cpp index 220a6cc025..013196dbaf 100644 --- a/src/generic/listbkg.cpp +++ b/src/generic/listbkg.cpp @@ -95,16 +95,10 @@ wxListbook::Create(wxWindow *parent, if ( GetListView()->InReportView() ) GetListView()->InsertColumn(0, wxS("Pages")); -#ifdef __WXMSW__ - // On XP with themes enabled the GetViewRect used in GetControllerSize() 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 will 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 + // Ensure that we rearrange the items in our list view after all the pages + // are added. + PostSizeEvent(); + return true; }