Key shortcut for this menu item.
When user presses indicated Key (if it's not K_None) or CharKey (if it's not #0) then DoClick will be called (which results in TCastleWindowBase.EventMenuClick, and TCastleWindowBase.OnMenuClick, if DoClick returns false).
Handling of menu key shortcuts is completely within the CastleWindow (usually, it's even done by the underlying backend like GTK or WinAPI). You will not get EventPress (OnPress) messages for keypresses that translate to menu clicks. Although TCastleWindowBase.Pressed.Keys will be still appropriately updated.
Note that Caption of this object should not contain description of Key or CharKey . The backend will automatically show the key description in an appropriate way.
You should use at most one of these properties, not both. So either use Key or CharKey , and leave the other one at default value (Key = K_None, CharKey = #0).
Note that CharKey = #8 (CharBackSpace = CtrlH) or CharKey = #9 (CharTab = CtrlI) or CharKey = #13 (CharEnter = CtrlM) are interpreted to mean the combination of letter with Ctrl modfier. They do not mean the backspace or tab or enter keys. If you want to have backspace/tab/enter keys to activate the menu item, use Key = K_BackSpace, Key = K_Tab or Key = K_Enter.
TODO: for now, this must be assigned before adding this menu item to parent (actually, before the parent menu is added to window MainMenu) to work reliably. Don't change this property afterwards. Usually, you will set this property by an argument to the constructor.
|