]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed GetSelection() inversion bug
authorKarsten Ballüder <ballueder@usa.net>
Sat, 15 Aug 1998 18:47:23 +0000 (18:47 +0000)
committerKarsten Ballüder <ballueder@usa.net>
Sat, 15 Aug 1998 18:47:23 +0000 (18:47 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@554 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/radiobox.cpp
src/gtk1/radiobox.cpp

index 6195828b7a2561011ba0d403bb8c8c87522d693c..e1e66d05c64824699bc23ac241e0df9111a30604 100644 (file)
@@ -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
index 6195828b7a2561011ba0d403bb8c8c87522d693c..e1e66d05c64824699bc23ac241e0df9111a30604 100644 (file)
@@ -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