]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/radiobox.cpp
Removed some bugs
[wxWidgets.git] / src / gtk1 / radiobox.cpp
index 6195828b7a2561011ba0d403bb8c8c87522d693c..c8120af62416e6a9b2a5ebe05101ec56f9730120 100644 (file)
@@ -79,7 +79,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
 //  if (((m_style & wxRA_VERTICAL) == wxRA_VERTICAL) && (n > 0))
   if (n > 0)
   {
-    GSList *radio_button_group = NULL;
+    GSList *radio_button_group = (GSList *) NULL;
     for (int i = 0; i < n; i++)
     {
       if (i) radio_button_group = gtk_radio_button_group( GTK_RADIO_BUTTON(m_radio) );
@@ -166,14 +166,16 @@ int wxRadioBox::GetSelection(void) const
 {
   GSList *item = gtk_radio_button_group( m_radio );
   int count = 0;
+  int found = -1;
   while (item)
   {
     GtkButton *button = GTK_BUTTON( item->data );
-    if (GTK_TOGGLE_BUTTON(button)->active) return count;
+    if (GTK_TOGGLE_BUTTON(button)->active) found = count;
     count++;
     item = item->next;
   }
-  return -1;
+  
+  return found != -1 ? count-found-1 : -1;
 }
 
 wxString wxRadioBox::GetString( int n ) const