Re: catching Glib::SignalProxy1< bool, GdkEventKey* > signal_key_press_event()



Bartek Kostrzewa wrote:

I would like to catch from the main window of my application (unless
that proves to work differently than I assume it will)

Glib::SignalProxy1< bool,GdkEventKey* > signal_key_press_event();

but I have no idea how to determine which key was pressed, how do I do it?

thanks,
Bartek
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Hi,
in the following file are all the keycodes 'include/gtk-2.0/gdk/gdkkeysyms.h' to see what key is pressed create a signal handler and connect it like this:

bool classname::key_press(GdkEventKey *key)
{
   if(key->keyval == GDK_a)
//do something when 'a' is pressed }

connect it for example to a window:
window.signal_key_press_event().connect(sigc::mem_fun(*this, &classname::key_press));

Hope this made it a bit clearer,

Grts Bart



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