Re: Detecting Ctrl Esc in GTK app

On 30 August 2011 16:50,  <jcupitt gmail com> wrote:
On 30 August 2011 15:22, Andrew Wood <a j w me com> wrote:
How would you link it directly to the window then rather than to a widget?

You can link a GClosure to a key press with this:

Parse "<ctrl>esc" to key/mod with

gtk_accelerator_parse( "<ctrl>esc", &key, &mods );

(I've not actually done this, I always use a widget, but I think it should work)

You have the key name wrong (the example is not in C but anyway):

Gtk::Accelerator.to_name *(Gtk::Accelerator.parse "<ctrl>esc")
=> "<Control>"

Gtk::Accelerator.to_name *(Gtk::Accelerator.parse "<ctrl>Escape")
=> "<Control>Escape"

Gtk::Accelerator.parse "<ctrl>Escape"
=> [65307, #<Gdk::Window::ModifierType control-mask>]



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