fixed GetSelection() inversion bug
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@554 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -166,14 +166,16 @@ int wxRadioBox::GetSelection(void) const
|
|||||||
{
|
{
|
||||||
GSList *item = gtk_radio_button_group( m_radio );
|
GSList *item = gtk_radio_button_group( m_radio );
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
int found = -1;
|
||||||
while (item)
|
while (item)
|
||||||
{
|
{
|
||||||
GtkButton *button = GTK_BUTTON( item->data );
|
GtkButton *button = GTK_BUTTON( item->data );
|
||||||
if (GTK_TOGGLE_BUTTON(button)->active) return count;
|
if (GTK_TOGGLE_BUTTON(button)->active) found = count;
|
||||||
count++;
|
count++;
|
||||||
item = item->next;
|
item = item->next;
|
||||||
}
|
}
|
||||||
return -1;
|
|
||||||
|
return found != -1 ? count-found-1 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxRadioBox::GetString( int n ) const
|
wxString wxRadioBox::GetString( int n ) const
|
||||||
|
@@ -166,14 +166,16 @@ int wxRadioBox::GetSelection(void) const
|
|||||||
{
|
{
|
||||||
GSList *item = gtk_radio_button_group( m_radio );
|
GSList *item = gtk_radio_button_group( m_radio );
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
int found = -1;
|
||||||
while (item)
|
while (item)
|
||||||
{
|
{
|
||||||
GtkButton *button = GTK_BUTTON( item->data );
|
GtkButton *button = GTK_BUTTON( item->data );
|
||||||
if (GTK_TOGGLE_BUTTON(button)->active) return count;
|
if (GTK_TOGGLE_BUTTON(button)->active) found = count;
|
||||||
count++;
|
count++;
|
||||||
item = item->next;
|
item = item->next;
|
||||||
}
|
}
|
||||||
return -1;
|
|
||||||
|
return found != -1 ? count-found-1 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxRadioBox::GetString( int n ) const
|
wxString wxRadioBox::GetString( int n ) const
|
||||||
|
Reference in New Issue
Block a user