- m_widget = gtk_radio_button_new_with_label( (GSList *) NULL, label );
-
- m_theOtherRadioButtton =
- gtk_radio_button_new_with_label(
- gtk_radio_button_group( GTK_RADIO_BUTTON(m_widget) ),
- "button2" );
-
- SetLabel(label);
+ GSList* radioButtonGroup = NULL;
+ if (!HasFlag(wxRB_GROUP))
+ {
+ // search backward for last group start
+ wxRadioButton *chief = (wxRadioButton*) NULL;
+ wxWindowList::compatibility_iterator node = parent->GetChildren().GetLast();
+ while (node)
+ {
+ wxWindow *child = node->GetData();
+ if (child->IsRadioButton())
+ {
+ chief = (wxRadioButton*) child;
+ if (child->HasFlag(wxRB_GROUP))
+ break;
+ }
+ node = node->GetPrevious();
+ }
+ if (chief)
+ {
+ // we are part of the group started by chief
+ radioButtonGroup = gtk_radio_button_get_group( GTK_RADIO_BUTTON(chief->m_widget) );
+ }
+ }
+
+ m_widget = gtk_radio_button_new_with_label( radioButtonGroup, wxGTK_CONV( label ) );