Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides   Examples
New in version: 6.1   6.2   6.3   6.4   6.5   7.0   7.1   7.2   7.3   7.4    Statistic  


Sets the receiver's unmodified key equivalent.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
Menu 4.1 Yes No No No No

MBS( "MenuItem.SetKeyEquivalent"; item; text )


Parameter Description Example value
item The reference to the menu item. Please create one with MenuItem.CreateMenuItem or MenuItem.CreateSeparator. $item
text A string containing a character code representing a keyboard key. If you want to remove the key equivalent from a menu item, pass an empty string. "T"


Returns OK or error.


Sets the receiver's unmodified key equivalent.
This method considers the case of the letter passed to determine if it has a Shift modifier added. That is, "w" sets the key equivalent to Command-w, while "W" is Command-Shift-w. You use MenuItem.SetKeyEquivalentModifierMask to set the appropriate mask for the modifier keys for the key equivalent.


Add menu item with key ⇧⌘T:

# set useful constants:
Set Variable [$ShiftKeyMask; Value:131072]
Set Variable [$ControlKeyMask; Value:262144]
Set Variable [$AlternateKeyMask; Value:524288]
Set Variable [$CommandKeyMask; Value:1048576]

#now make menu entry
Set Variable [$item; Value:MBS("MenuItem.CreateMenuItem"; "With Key Equivalent")]
Set Variable [$r; Value:MBS("MenuItem.SetKeyEquivalent"; $item; "T")]
Set Variable [$r; Value:MBS("MenuItem.SetKeyEquivalentModifierMask"; $item; $ShiftKeyMask + $CommandKeyMask)]
Set Variable [$r; Value:MBS("Menu.AddItem"; $menu; $item)]

See also

Example Databases

MenuItem.SetItalic   -   MenuItem.SetKeyEquivalentModifierMask

Feedback: Report problem or ask question.

MBS Xojo Plugins