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  

MenuItem.SetKeyEquivalentModifierMask

Sets the menu items's keyboard equivalent modifiers.

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

MBS( "MenuItem.SetKeyEquivalentModifierMask"; item; mask )

Parameters

Parameter Description Example value
item The reference to the menu item. Please create one with MenuItem.CreateMenuItem or MenuItem.CreateSeparator. $item
mask The key masks indicate modifiers such as the Shift or Option keys. mask is a number and you can add the constants below. 524288

Result

Returns OK or error.

Description

Sets the menu items's keyboard equivalent modifiers.
In general, you are strongly encouraged to always set NSCommandKeyMask in mask, although there may be some conventions where this is not required. For example, in an application that plays media, the Play command may be mapped to just " ” (space), without the command key.
NSShiftKeyMask is a valid modifier for any key equivalent in mask. This allows you to specify key-equivalents such as Command-Shift-1 that are consistent across all keyboards. However, with a few exceptions (such as the German "ß” character), a lowercase character with NSShiftKeyMask is interpreted the same as the uppercase character without that mask. For example, Command-Shift-c and Command-C are considered to be identical key equivalents.

NSShiftKeyMask131072Shift Key
NSControlKeyMask262144Control Key
NSAlternateKeyMask524288Alternate/Option Key
NSCommandKeyMask1048576Command Key

Examples

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.SetKeyEquivalent   -   MenuItem.SetMixedStateImage

Feedback: Report problem or ask question.




Links
MBS FileMaker Plugins