Re: Gtk::RadioButton??!!



>The thinng is that I am doing that, but the window is still displayed 
>with all the radio buttons turned on.
>
>What am I doing wrong!!?
>
>OS: WIN32
>GTKmm = 2.4.x
>class MyClass : virutual public Gtk::Frame{
>...
>  Gtk::RadioButton* rbMr;
>   Gtk::RadioButton* rbMiss;
>   Gtk::RadioButton* rbMss;
>   Gtk::RadioButton* rbNone;
>   Gtk::HBox* hboxGender;
>   Gtk::VBox* vbox2_2;
>.....
>};
>MyClass::MyClass(){
>   rbMr            = manage(new Gtk::RadioButton("Mr"));
>   rbMiss          = manage(new Gtk::RadioButton("Mrs"));
>   rbMss           = manage(new Gtk::RadioButton("Ms"));
>   rbNone        = manage(new Gtk::RadioButton("None"));
>   hboxGender    = manage(new Gtk::HBox());
>   vbox2_2       = manage(new Gtk::VBox());
>
>
>
>    rbMr->set_active(true);
>    rbMiss->set_active(false);
>    rbMss->set_active(false);
>    rbNone->set_active(false);
>......
>    hboxGender->pack_start(*rbMr,    Gtk::PACK_SHRINK,5);
>    hboxGender->pack_start(*rbMiss,  Gtk::PACK_SHRINK,5);
>    hboxGender->pack_start(*rbMss,   Gtk::PACK_SHRINK,5);
>    hboxGender->pack_start(*rbNone,  Gtk::PACK_SHRINK,5);
>......
>    vbox2_2->pack_start(*hboxGender, Gtk::PACK_EXPAND_WIDGET);
>   .....
>}
>

Maybe you add all RadioButtons to group?
Like this:
Gtk::RadioButton::Group group = rbutton1->get_group();
rbutton2->set_group(group);

and than use .set_active() method for button you want be active

Alex.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]