Hi!
You can do one of the following:
- add the OK Button with
Button* ok_button = add_button(Gtk::Stock::OK, Gtk::REPONSE_OK);
and connect ok_button->signal_clicked().
- add the button like above (or using the ButtonsType argument of the
constructor) and connect to signal_response() of the MessageDialog.
Regards,
Johannes
Jamiil Abduqadir schrieb:
> Hello,
> I am writing a class that derives from 'Gtk::MessageDialog'. What does
> the class do? you got it, it displays a dialog box with some information
> on it. Now, to the problem. Just like any 'Gtk::MessageDialog' it has a
> button in there that I need to connect to a signal, but since I don't
> know the name of the button, I cannot write something like
>
> Mybutton.signal_clicked().connect(sigc::ptr_fun(&on_button_clicked));
>
>
> What can I do to find the object name of Gtk::Button in the
> Gtk::MessageDialog?
>
>
> ------snip------
> namespace jme{
> class GtkmmException : public virtual Gtk::MessageDialog{
> private:
> jme::Exception* ex;
>
> protected:
> public:
> GtkmmException(Glib::ustring&, jme::Exception&);
>
> ~GtkmmException();
>
> virtual void btnClicked();
> }; // class
> }
>
> jme::GtkmmException::GtkmmException( Glib::ustring& str, jme::Exception& e)
> : Gtk::MessageDialog(str){
> try{ex = new jme::Exception();}
> catch(std::bad_alloc& x){ std::cout << x.what(); exit(-1); }
> ex->copy(e);
>
> Gtk::MessageDialog::set_moday(true);
>
> Is this right?
> ~~~~~~~~~~
> this->signal_clicked().connect( sigc::mem_fun(*this,
> &GtkmmException::btnClicked) );
> }
> //void jme::GtkmmException::btnClicked(){/*Initiate atomic reactor,
> hihihi*/}
>
> jme::GtkmmException::~GtkmmException(){ delete ex;}
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
Attachment:
signature.asc
Description: OpenPGP digital signature