Radiobox selection Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
rafae11
Experienced Solver
Experienced Solver
Posts: 85
Joined: Sat Jun 02, 2012 8:41 am

Radiobox selection

Post by rafae11 » Sat Jun 02, 2012 3:52 pm

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.

User avatar
doublemax
Moderator
Moderator
Posts: 14194
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Radiobox selection

Post by doublemax » Sat Jun 02, 2012 8:16 pm

wxRadioBox::SetSelection() is the correct method, what's the problem?
Use the source, Luke!

rafae11
Experienced Solver
Experienced Solver
Posts: 85
Joined: Sat Jun 02, 2012 8:41 am

Re: Radiobox selection

Post by rafae11 » Sat Jun 02, 2012 8:24 pm

my mistake i was choosing index starting at index 1 to 2
instead of 0 and 1.

Post Reply