Page 1 of 1

Radiobox selection

Posted: Sat Jun 02, 2012 3:52 pm
by rafae11
i have a radiobox declared from the wxformbuilder.
i want one of the choices to be selected if one of the following conditions apply.

Code: Select all

ttc = new wxRadioBox( m_panel4, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, ttcNChoices, ttcChoices, 1, wxRA_SPECIFY_COLS );

void test::open()
{
int test;
if ( test < 0)
 { 
ttc->SetSelection( 2 );
test = test * -1;
}
else 
{
test = test;
ttc->SetSelection( 1 );
}

output->SetValue(wxString::Format(wxT("%d"),test));
}
please help.

Re: Radiobox selection

Posted: Sat Jun 02, 2012 8:16 pm
by doublemax
wxRadioBox::SetSelection() is the correct method, what's the problem?

Re: Radiobox selection

Posted: Sat Jun 02, 2012 8:24 pm
by rafae11
my mistake i was choosing index starting at index 1 to 2
instead of 0 and 1.