I've tried the Gtk::Dialog and, although it does closes when pressing the esc key, it doesn't suit very well with what I'm trying to do.
I would prefer to use the signals, any ideas? On Thu, Aug 25, 2011 at 8:54 PM, Mikhail Titov <[email protected]> wrote: > I didn't notice Q about a function. > You can define override a function > > void YourDialog::on_response(int id) {} > > And check id like if (Gtk::RESPONSE_OK == id) { blah > > And don't forget to hide it with hide() or don't call it if you are not > happy with validation. > > Mikhail > > >> -----Original Message----- >> From: [email protected] [mailto:[email protected]] >> On Behalf Of Mikhail Titov >> Sent: Thursday, August 25, 2011 2:49 PM >> To: 'Yann LEYDIER'; [email protected] >> Subject: RE: keyboard events >> >> IIRC if you derive your class from Dialog instead of Window, it will do it >> by default. >> >> Mikhail >> >> >> > -----Original Message----- >> > From: [email protected] [mailto:[email protected]] >> > On Behalf Of Yann LEYDIER >> > Sent: Thursday, August 25, 2011 2:17 PM >> > To: [email protected] >> > Subject: Re: keyboard events >> > >> > Hi, >> > >> > signal_key_release_event() seems the right way to do it. For the list of >> > key values, see gdk/gdkkeysyms.h as stated in Gtk's documentation : >> > http://developer.gnome.org/gdk/stable/gdk-Event- >> > Structures.html#GdkEventKey >> > >> > You could also derivate your class from Gtk::Dialog, which recieves a >> > response when ESC is pressed. >> > >> > yann >> > >> > On 25/08/11 21:00, lecas malecas wrote: >> > > Hey, I have a window which I want to close when the esc key is >> > > pressed, I've tried overriding the "virtual bool on_key_release_event >> > > (GdkEventKey* event); " but I get some weird errors (also can't find >> > > the documentation about GdkEventKey, to identify the keys). I tried >> > > adding a function to the "signal_key_release_event()" but also get >> > > some errors :) >> > > >> > > Can anyone tell me how to call a function when the esc key is pressed >> > > (on a Gtk::Window derived class)? >> > > _______________________________________________ >> > > 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 >> >> _______________________________________________ >> 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 > _______________________________________________ gtkmm-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gtkmm-list
