From: Vadim Zeitlin Date: Tue, 22 Dec 2009 15:37:37 +0000 (+0000) Subject: Fix best size computation for buttons without image and with empty label. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/4b601a59b5f303a8866a18c90fff90aff393c6b7?ds=sidebyside Fix best size computation for buttons without image and with empty label. If a button was initially created with an empty label (but without image neither), its best size was computed and cached as being null. Correct this by giving the button the default size instead, as expected. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62970 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/button.cpp b/src/msw/button.cpp index cef76c26d3..67494356d6 100644 --- a/src/msw/button.cpp +++ b/src/msw/button.cpp @@ -574,8 +574,10 @@ wxSize wxButton::DoGetBestSize() const { wxSize size; - // account for the text part - if ( ShowsLabel() ) + // account for the text part if we have it or if we don't have any image at + // all (buttons initially created with empty label should still have a non + // zero size) + if ( ShowsLabel() || !m_imageData ) { size = wxMSWButton::ComputeBestSize(const_cast(this)); }