Hi! What about Gtk::MessageDialog("",false,Gtk::MESSAGE_ERROR, Gtk::BUTTONS_NONE, false) and adding the button afterwards? I am not sure what you really want to do. If you want to use the response signal you will have to show your dialog using Gtk::Dialog::run(). This is no problem of the toolkit BTW, not even on Win32. It's just a logic problem but I hope you can solve it now. If you are still not sure you should tell us what you want to do without how because maybe it is much easier without a MessageDialog. Please always CC the list! Regards, Johannes Jamiil Abduqadir schrieb: > Thanks Johannes for your prompt response. > You are absolutelly right, these are very good choices, I had arrived to > that conclussion as well. However, I found that adding a button myself > will contitute an additional button, making it two buttons to appear in > the same dialog box, so I went for the second option i.e. > > Gtk::MessageDialog("",false,Gtk::MESSAGE_ERROR, Gtk::BUTTONS_CLOSE, false ) > > This changed the OK button to a Cancel button, but the cancel button is > still unresponsive, just like the OK button was. > > A third option would be to remove the existing button and replace it > with my own, but again the gtkmm folks did not give us any access to the > button only to the text :( > > Another problem I have been contemplating is that I am using MS-WIN XP > and that it might be that the problem only exists in the Windows port of > the toolkit. > > Again, thanks for the help > On 12/28/06, *Johannes Schmid* <johannes schmid gmx de > <mailto:johannes schmid gmx de>> wrote: > > 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 <mailto:gtkmm-list gnome org> > > http://mail.gnome.org/mailman/listinfo/gtkmm-list > <http://mail.gnome.org/mailman/listinfo/gtkmm-list> > > > >
Attachment:
signature.asc
Description: OpenPGP digital signature