From: Vadim Zeitlin Date: Tue, 15 Nov 2011 15:46:01 +0000 (+0000) Subject: Only update status bar fields after they were created in wxMSW. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/a496a72d6651449ffcab6d76f182edb14e2f9141?ds=inline Only update status bar fields after they were created in wxMSW. Postpone updating statu bar panes after they were actually created. Setting the status bar fields contents before setting the number of them failed resulting in debug error messages and the text not appearing in the status bar. Closes #13670. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69761 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/statusbar.cpp b/src/msw/statusbar.cpp index b82db9553b..7bfb81bc9d 100644 --- a/src/msw/statusbar.cpp +++ b/src/msw/statusbar.cpp @@ -229,12 +229,11 @@ void wxStatusBar::MSWUpdateFieldsWidths() int *pWidths = new int[count]; int nCurPos = 0; - for ( int i = 0; i < count; i++ ) + int i; + for ( i = 0; i < count; i++ ) { nCurPos += widthsAbs[i] + extraWidth; pWidths[i] = nCurPos; - - DoUpdateStatusText(i); } // The total width of the panes passed to Windows must be equal to the @@ -247,6 +246,12 @@ void wxStatusBar::MSWUpdateFieldsWidths() wxLogLastError("StatusBar_SetParts"); } + // Now that all parts have been created, set their text. + for ( i = 0; i < count; i++ ) + { + DoUpdateStatusText(i); + } + delete [] pWidths; }