Hot keys – with problems

Quick menu access is done by Alt and the underlined char, this is the same for Windows and Linux. The most popular defaults are Alt-F for file, Alt-E for edit and Alt-V for view.

Padre introduced a dynamic menu bar in the upcoming 0.50 release meaning that the menu bar items are configurable (even if there is still no GUI dialog for that). Plugins and document types may also add their menus to the main menu bar now, but this is where the problems begin.

Menus which are no longer static and spread over various projects (plugins) and a menu bar which depends on the plugins selected by the user make it very hard to keep the classic hotkeys working:

  • If the developer assigns the hotkeys, a “Foo” menu item could easily end up using F as hotkey which is already used by “File”. Even if the core menu items are few, checking all plugins for collisions is nearly impossible.
  • Dynamic assigned chars will mix up the classic known default bindings sooner or later and could change between two starts of Padre if the user activates or deactivates a plugin.

Revision 9070 solved this problem for Padre using “best of both worlds”: Hotkeys are assigned by the developer by writing “&File” to automatically assign the “F” to the “File” menu, but Padre still checks this assignment. If you use both “&Perl” and “&PHP”, Padre detects the collision and solves it by assigning the hotkey to the first plugin requesting it and setting another one for the second requester.

Translations are even worse: Wx::gettext is frequently used, but still no good solution. The translator doesn’t know which items belong together and where the translations are being used. “&Perl” and “&Plugin” could easily happen within one menu. Padre’s new checks also solves this collision as mentioned earlier.

Static bindings would be best for developers: Easy to do and to maintain. A Wiki page or textfile could hold the list of assigned chars, every plugin requiring  a char is being added and there are no collisions possible. But this doesn’t work, because the English “View” (using the V) can’t be referenced in the German “Ansicht” which usually uses the “A” (and has no “V” within the word which could be underlined).

Bookmark and Share

Tags: , , , ,

Leave a Reply