Opened 13 years ago

Last modified 2 months ago

#2615 assigned enhancement

Improved keyboard navigation with triggers

Reported by: denisw Owned by: nobody
Priority: normal Milestone: R1
Component: Kits/Interface Kit Version: R1/pre-alpha1
Keywords: Cc: prognathous@…
Blocked By: Blocking:
Platform: All


While many Haiku apps use shortcuts for several menu items, I realized that there is no functionality to quickly navigate through Haiku UIs with the keyboard. Many toolkits in other OS's have "mnemonics" for this purpose, which are displayed as underlined letters in menu or button labels. Pressing this letter key (in combination with a certain modifier) focuses and activates the control. For instance, if you have a "Cancel" button with an underlined "C", you can press e.g. Ctrl+C to activate the button.

Looking into the Be Book, BMenuItem has a SetTrigger() method which seems to be just like that (except that you don't have to press a modifier, which makes sense because the menu is already focused). It would be nice if this feature could be useable in more controls though, such as buttons, tabs, and the menus of a menu bar.

My proposal is # the addition of a SetUseTrigger(bool useTrigger) method to BControl. If true is passed (the default might have to be false for compatibility reasons), the first character of the control's label with a leading "_" will be made the trigger character of that control and underlined in appearance (the "_" itself will not be shown). The advantage of this API in comparison to BMenuItem's current SetTrigger() is easier translation (when support for translation is added later on): as the trigger key will likely be different from language to language, it is easier to have the string and the trigger in one string instead of being spread in a string and a separate character.

I hope this would be a valid API addition for R1.

Change History (4)

comment:1 by anevilyak, 13 years ago

Component: - GeneralKits/Interface Kit

Switching components.

comment:2 by Prognathous, 12 years ago

Cc: prognathous@… added

comment:3 by axeld, 5 years ago

Owner: changed from axeld to nobody
Status: newassigned
Note: See TracTickets for help on using tickets.