From d96b9cafb8590da68df21aa81696ed33988f3a91 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 31 Oct 2006 16:37:52 +0000 Subject: [PATCH] don't compute (and mainly don't cache) our best size until we have created the radio buttons git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42861 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/radiobox.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/msw/radiobox.cpp b/src/msw/radiobox.cpp index af016c9a15..45424eb27e 100644 --- a/src/msw/radiobox.cpp +++ b/src/msw/radiobox.cpp @@ -206,10 +206,6 @@ bool wxRadioBox::Create(wxWindow *parent, SetWindowPos(GetHwnd(), HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); #endif - // Have to invalidate the best size as it may have been calculated - // before the number of buttons was known - InvalidateBestSize(); - SetMajorDim(majorDim == 0 ? n : majorDim, style); SetSelection(0); SetSize(pos.x, pos.y, size.x, size.y); @@ -509,6 +505,13 @@ wxSize wxRadioBox::GetTotalButtonSize(const wxSize& sizeBtn) const wxSize wxRadioBox::DoGetBestSize() const { + if ( !m_radioButtons ) + { + // if we're not fully initialized yet, we can't meaningfully compute + // our best size, we'll do it later + return wxSize(1, 1); + } + wxSize best = GetTotalButtonSize(GetMaxButtonSize()); CacheBestSize(best); return best; -- 2.45.2