MenuItem.SetKeyEquivalentModifierMask
-------------------------------------

Sets the menu items's keyboard equivalent modifiers.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Menu](component_Menu.md) | [4.1](newinversion41.md) | ✅ Yes | ❌ No | ❌ No | ❌ No | ❌ No |

MBS( "MenuItem.SetKeyEquivalentModifierMask"; Item; Mask ) 

**MBS**( **"MenuItem.SetKeyEquivalentModifierMask";** /\* Sets the menu items's keyboard equivalent modifiers. \*/  
**$Item**; /\* The reference to the menu item. Please create one with [MenuItem.CreateMenuItem](MenuItemCreateMenuItem.md) or [MenuItem.CreateSeparator](MenuItemCreateSeparator.md). \*/   
**$Mask**) /\* The key masks indicate modifiers such as the Shift or Option keys. mask is a number and you can add the constants below.e.g. 524288 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Item | The reference to the menu item. Please create one with [MenuItem.CreateMenuItem](MenuItemCreateMenuItem.md) or [MenuItem.CreateSeparator](MenuItemCreateSeparator.md). | $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.  
  
| NSShiftKeyMask | 131072 | Shift Key |
|---|--:|---|
| NSControlKeyMask | 262144 | Control Key |
| NSAlternateKeyMask | 524288 | Alternate/Option Key |
| NSCommandKeyMask | 1048576 | Command 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](MenuItemCreateMenuItem.md)"; "With Key Equivalent")\]  
Set Variable \[$r ; Value:MBS ("[MenuItem.SetKeyEquivalent](MenuItemSetKeyEquivalent.md)"; $item ; "T")\]  
Set Variable \[$r ; Value:MBS ("MenuItem.SetKeyEquivalentModifierMask"; $item ; $ShiftKeyMask + $CommandKeyMask )\]  
Set Variable \[$r ; Value:MBS ("[Menu.AddItem](MenuAddItem.md)"; $menu ; $item )\]  
### See also

- [Menu.AddItem](MenuAddItem.md)
- [MenuItem.CreateMenuItem](MenuItemCreateMenuItem.md)
- [MenuItem.CreateSeparator](MenuItemCreateSeparator.md)
- [MenuItem.GetKeyEquivalentModifierMask](MenuItemGetKeyEquivalentModifierMask.md)
- [MenuItem.SetKeyEquivalent](MenuItemSetKeyEquivalent.md)

### Example Databases

- [Menu/Popup Menu](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Menu/Popup%20Menu.shtml#2ScriptAnchor_)

This function checks for a license.

Created 18th August 2014 , last changed 15th April 2015

  
[MenuItem.SetKeyEquivalent](MenuItemSetKeyEquivalent.md) - [MenuItem.SetMixedStateImage](MenuItemSetMixedStateImage.md)

[HTML Version](MenuItemSetKeyEquivalentModifierMask.shtml)