Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » [Allegro 5] How to list keyboard shortcuts in menu?

This thread is locked; no one can reply to it. rss feed Print
[Allegro 5] How to list keyboard shortcuts in menu?
utz000
Member #16,715
July 2017

Hi,

Is there a good way to add associated keyboard shortcuts to menu item captions, other than directly appending it to the caption? For example with wxWidgets, you can use \t to seperate/right-align part of the caption. Is there any equivalent of this in Allegro 5?

I know I can underline letters by prepending "&", but that's not what I want.

Todd Cope
Member #998
November 2000
avatar

There is currently no way to do this using the Allegro 5 API.

SiegeLord
Member #7,827
October 2006
avatar

For Windows, it's as easy as adding the \t. I tried looking into how to do this for GTK, but it is not as obvious. Would have to see how wxWidgets does it.

EDIT: Looks like it is not too bad: https://github.com/wxWidgets/wxWidgets/blob/master/src/gtk/menu.cpp#L657

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

utz000
Member #16,715
July 2017

Ok, good to know, and thanks for the replies you two.

SiegeLord, it'd be great to have this available for GTK at some point. Already had a look at gtk_menu.c myself to see if I could do something about it, but unfortunately it's a bit beyond my current coding skills :o

Go to: