Basically the only way to put the shortcut symbols into the menu is to actually assign the shortcut to the menu item. It doesn't hurt though if you do it again using AddKeyboardShortcut(), so just do that too and it will work on all platforms.
Basically the only way to put the shortcut symbols into the menu is to actually assign the shortcut to the menu item. It doesn't hurt though if you do it again using AddKeyboardShortcut(), so just do that too and it will work on all platforms.
Hi Freak,
just a few lines of extra-code, and my Programs support Menu-Shortcuts on Windows as well. Mac OS is my primary development platform, so at first, I didn't know about the Shortcuts.
This actually produces an unwanted behaviour when coding and should be treated as a bug.
I have in my menu two items that uses the same shortcut key, simply because I want to be able to toggle fast between them. Obviously, as some of you probably dying to point out I could have only one item and change the label every other time. To make it short, the two item solution is the proper behaviour in the grand scheme of the program.
So, if you have a shortcut that assigns a key, in this case F to all events pertaining to the key, you loose the ability to listen to that event in the event loop. In simpler terms, event 100 is never triggered in the code below when you push F, only 30.
snip----
AddKeyboardShortcut(w()\win, #PB_Shortcut_F, 100)
MenuItem(30, "Full size" + Chr(9) + "F")
MenuItem(31, "Fit largest side to screen" + Chr(9) + "F")
----
If you do the less aesthetically pleasing method of white-spacing (the characters do not always align up well on the right side), it works as it should. I.e. 100 is triggered on a F, and 30 and 31 respectively when you push them in the menu.
snip----
AddKeyboardShortcut(w()\win, #PB_Shortcut_F, 100)
MenuItem(30, "Full size F")
MenuItem(31, "Fit largest side to screen F")
----
If it should not be treated as a bug, please motivate. Could someone otherwise help me move this thread to the bug section.
MacBook Pro (model 7,1) - 2.4GHz Intel Core 2 Duo 4GB - OS X 10.7 Lion.
PB 4.60 RC1