From fab97536810dea903b79322144f9b110368876a6 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 18 Dec 2009 22:31:54 +0000 Subject: [PATCH] Don't create labels with wxST_NO_AUTORESIZE flag with empty size by default. Since r57627 wxStaticText objects with wxST_NO_AUTORESIZE flag created with wxDefaultSize were created with zero width. This accounted for the disappearance of the labels for the toolbar controls (as could be seen in the toolbar sample where the combobox label was not shown any more). Fix this by explicitly setting the correct initial size after the correct label is set. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62935 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/stattext.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/msw/stattext.cpp b/src/msw/stattext.cpp index 898487a88c..a2862c2179 100644 --- a/src/msw/stattext.cpp +++ b/src/msw/stattext.cpp @@ -101,6 +101,11 @@ bool wxStaticText::Create(wxWindow *parent, // need to do many operation on it for ellipsization&markup support SetLabel(label); + // as we didn't pass the correct label to MSWCreateControl(), it didn't set + // the initial size correctly -- do it now + InvalidateBestSize(); + SetInitialSize(size); + // NOTE: if the label contains ampersand characters which are interpreted as // accelerators, they will be rendered (at least on WinXP) only if the // static text is placed inside a window class which correctly handles