Sorry I forgot to send this to the list As Guillaume said, set_active is specific to Gtk::ToggleButton and derived classes. So if you don't want (or cant) use set_active() directly, you could use a pointer to Gtk::ToggleButton instead of a pointer to Gtk::Widget* : Gtk::ToggleButton btnOK; Gtk::ToggleButton *ptrElement = NULL;
ptrElement = &btnOK; ptrElement->set_active(true); If your pointer sometimes points at other kinds of Widgets, you could still use a pointer to Gtk::Widget, and then cast it to a pointer to Gtk::ToggleButton before using it: dynamic_cast<Gtk::ToggleButton *>(ptrElement)->set_active(true); Keep in mind that this will give you an error if at that moment ptrElement does not point to a Gtk::ToggleButton (or descendant) Jody On Tue, Mar 17, 2009 at 3:58 PM, Paulo Flabiano Smorigo <[email protected]> wrote: > On Tue, Mar 17, 2009 at 11:40, Guillaume Brocker > <[email protected]> wrote: >> Paulo Flabiano Smorigo a écrit : >>> >>> Hello, >>> >>> What can I do to solve the following error? I need to use a different >>> kind of pointer? >>> >>> The code: >>> Gtk::ToggleButton btnOK; >>> Gtk::Widget *ptrElement = NULL; >>> >>> ptrElement = &btnOK; >>> >>> ptrElement->set_active(true); >>> >>> The error: >>> error: ‘class Gtk::Widget’ has no member named ‘set_active’ >> >> Gtk::Widget has no member ‘set_active’. This member is specific to >> Gtk::ToggleButton and derived classes. Wy don't you call ‘btnOK.set_active’ >> directly ? >> >>> Thanks in advance, >>> Paulo Flabiano Smorigo >> >> Guillaume >> > > Hi Guillaume, > > Thanks for the fast reply... > > I know that the Gtk::Widget don't have the set_active() member but as > it is pointing to a ToggleButton widget, isn't it possible to use the > method? > > I there a someway to make the pointer accept the method? > > Thanks... > Paulo Flabiano Smorigo > _______________________________________________ > gtkmm-list mailing list > [email protected] > http://mail.gnome.org/mailman/listinfo/gtkmm-list > _______________________________________________ gtkmm-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gtkmm-list
