Re: Understanding accelerators.



Mnemonics are discouraged by the HIG, and AFAIK they are not displayed by
recent GTK versions.

From the user's perspective, I think there is no difference. However, if
you are using GApplication/GtkApplication, it is easier to register accels,
and you can even make them easily customizable for the users. I'm yet to
find a good example on the Interwebs, but if you take a look at GNOME 3.14
apps, you will find some for sure.

Best,
Gergely
On 7 Oct 2014 16:12, "Michael Cronenworth" <mike cchtml com> wrote:

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



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