hidden widgets



Hi,
I have a notebook page with many input widgets, some of them in  a frame. In the frame label I have a checkbox. The checkbox is a flag, so its value means that input widgets in the frame is applicable or not.

...
frameUser.set_label_align(Gtk::ALIGN_RIGHT); // frameUser is a Window member
Gtk::HBox *hb = Gtk::manage(new Gtk::HBox());
hb->pack_start(*Gtk::manage(new Gtk::Label("User", Gtk::ALIGN_RIGHT)), Gtk::PACK_SHRINK);
hb->pack_start(checkUser, Gtk::PACK_SHRINK); // checkUser is a window member
checkUser.signal_clicked().connect(sigc::bind(sigc::mem_fun(*this, &Page_Clerk::on_checkUser_toggled), &checkUser));
frameUser.set_label_widget(*hb);
...
...
void Page_Clerk::on_checkUser_toggled(Gtk::CheckButton *cb)
{
    Gtk::Widget *w = frameUser.get_child();
    if(cb->get_active())
    {
        w->show_all();
    }
    else
    {
        w->hide_all();
    }
}
...


The child of the frame is a Gtk::Table, that contains all the input widgets.
This works well but I also wish that the contents of the frame would be initially hidden.
If I call on_checkUser_toggled(&checkUser) directly from the constructor, it has no effect.
If I call on_checkUser_toggled(&checkUser) directly from the on_realize event of the page I get an error.

I am a beginner
István



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