Keyboard Shortcuts in Menus
Björnke von Gierke
bvg at mac.com
Tue Nov 11 10:51:15 EST 2014
Question 1:
The & only works for Windows, where menus can be triggered with the keyboard. The character after the & will be the one to trigger, and it'll be shown underlined. You can choose any char in a word, it doesn't need to be the first one, and the premade ones are chosen as per Windows human interface guidelines (for example T being the trigger for 'Cut', or R for 'Clear').
Question 2:
I'm not sure, but one thing to note is that if you change menus, you of course also need to change scripts, for them to actually do anything useful. So if you change "quit" to "exit", you need to accommodate for that in the script. For example if you use the "Auto Script" feature of the menu builder:
--The following menuPick handler was generated by the Menu Builder.
on menuPick pWhich
switch pWhich
case "New"
--Insert script for New menu item here
break
-- some parts removed here for example purposes
case "Quit"
-- just add this line here for exit to do the same as quit:
case "Exit"
--Insert script for Quit menu item here
break
end switch
end menuPick
On 11 Nov 2014, at 16:32, Graham Samuel <livfoss at mac.com> wrote:
> I'm using LC 7.0.1. Looking at both the LC User Guide and the Dictionary, I find that I don’t exactly understand the way you put keyboard shortcuts into menus and get them to activate, especially on Windows. I note for example:
>
> 1. The ‘&’ character is always present in a menu item which is also intended to work as a keyboard shortcut, but it isn’t always at the beginning of the menu’s text. Is there are reason for this, or is it just wilful eccentricity on the part of the Menu Builder?
>
> 2. In a cross platform app, I use a script at startup to switch the last item of my 'File' menu from the Mac’s ‘Quit’ text
>
> &Quit/Q
>
> to the Windows equivalent
>
> &Exit/x
>
> This looks OK on the menu item display, but I don't think this works, even though the standard shortcuts (Cut, Copy, Paste) work in the 'Edit' menu, and they don't look any different in form. Naturally I may just have made a silly mistake, but so far I can't see what it is.
>
> Can anyone explain what is going on behind the scenes?
>
> BTW, I don't especially care for the Menu Builder, but it seems that the LC documentation assumes one is going to use it - maybe that's why the documentation is a bit sketchy.
>
> TIA
>
> Graham
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list