On 10/07/2014 04:45 AM, Oscar Lazzarino wrote:
I'm trying to understand the difference between accelerators and the
“key-press-event” signal.
Let's say I have a window with just one button "quit". I'd like to handle the
<controlo>q key event to quit the application.
I now I can connect to the top window key-press-event, but - just to understand
how things work - is there any way to do the same with accelerators? Or are
accelerators exclusively intended to be used with menus?
I'm totally lost in the documentation bouncing between actions, accelerators,
accerator groups, action groups, ui managers, etc, and I can't find a SIMPLE
example.
Any help would be greatly appreciated.
There are menu accelerators and there are mnemonic accelerators. What you need
to use for a "quit" button is a mnemonic accelerator. You do not attach to any
key-press signal. Attach to the button clicked signal. GTK provides the
functionality to capture the keyboard press and route it to the button click.
You're complicating this a little. It's not that complicated. :)
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list