/////////////////////////////////////////////////////////////////////////////
-// Name: src/osx/radiobox.cpp
+// Name: src/osx/radiobox_osx.cpp
// Purpose: wxRadioBox
// Author: Stefan Csomor
// Modified by: JS Lair (99/11/15) first implementation
{
if ( outer.IsChecked() )
{
- wxCommandEvent event( wxEVT_COMMAND_RADIOBOX_SELECTED, m_windowId );
+ wxCommandEvent event( wxEVT_RADIOBOX, m_windowId );
int i = GetSelection() ;
event.SetInt(i);
event.SetString(GetString(i));
int n, const wxString choices[],
int majorDim, long style,
const wxValidator& val, const wxString& name )
-{
- m_macIsUserPane = false ;
-
+{
+ DontCreatePeer();
+
if ( !wxControl::Create( parent, id, pos, size, style, val, name ) )
return false;
- int i;
-
- m_noItems = (unsigned int)n;
+ // during construction we must keep this at 0, otherwise GetBestSize fails
+ m_noItems = 0;
m_noRowsOrCols = majorDim;
m_radioButtonCycle = NULL;
SetPeer(wxWidgetImpl::CreateGroupBox( this, parent, id, label, pos, size, style, GetExtraStyle() ));
- for (i = 0; i < n; i++)
+ for (int i = 0; i < n; i++)
{
wxRadioButton *radBtn = new wxRadioButton(
this,
// m_radioButtonCycle = radBtn->AddInCycle( m_radioButtonCycle );
}
+ // as all radiobuttons have been set-up, set the correct dimensions
+ m_noItems = (unsigned int)n;
+ SetMajorDim( majorDim == 0 ? n : majorDim, style );
+
SetSelection( 0 );
+ InvalidateBestSize();
+ SetInitialSize( size );
MacPostControlCreate( pos, size );
return true;
}
// Sets a button by passing the desired position. This does not cause
-// wxEVT_COMMAND_RADIOBOX_SELECTED event to get emitted
+// wxEVT_RADIOBOX event to get emitted
//
void wxRadioBox::SetSelection(int item)
{