SetSize(pos.x, pos.y, size.x, size.y);
// Now that we have items determine what is the best size and set it.
- SetBestSize(size);
+ SetInitialSize(size);
return true;
}
unsigned int wxRadioBox::GetCount() const
{
- return m_radioButtons->GetCount();
+ return m_radioButtons ? m_radioButtons->GetCount() : 0u;
}
void wxRadioBox::SetString(unsigned int item, const wxString& label)
// and also wide enough for its label
int widthLabel;
- GetTextExtent(wxStripMenuCodes(GetLabel()), &widthLabel, NULL);
+ GetTextExtent(GetLabelText(), &widthLabel, NULL);
widthLabel += RADIO_SIZE; // FIXME this is bogus too
if ( widthLabel > width )
width = widthLabel;
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;