MenuItem.SetEnabled
-------------------

Sets whether the menu item is enabled.

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

MBS( "MenuItem.SetEnabled"; Item; Flag ) 

**MBS**( **"MenuItem.SetEnabled";** /\* Sets whether the menu item is enabled. \*/  
**$Item**; /\* The reference to the menu item. Please create one with [MenuItem.CreateMenuItem](MenuItemCreateMenuItem.md) or [MenuItem.CreateSeparator](MenuItemCreateSeparator.md). \*/   
**$Flag**) /\* The enabled state. Pass 1 to enable or 0 to disable.e.g. 1 \*/ 

### 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 |
| Flag | The enabled state. Pass 1 to enable or 0 to disable. | 1 |

### Result

Returns OK or error.

### Description

Sets whether the menu item is enabled.  
See also [MenuItem.GetEnabled](MenuItemGetEnabled.md).  
### Examples

Add a disabled menu item:

 Set Variable \[$item ; Value:MBS ("[MenuItem.CreateMenuItem](MenuItemCreateMenuItem.md)"; "Hello World")\]  
Set Variable \[$r ; Value:MBS ("MenuItem.SetEnabled"; $item ; 0)\]  
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.GetEnabled](MenuItemGetEnabled.md)
- [MenuItem.SetImage](MenuItemSetImage.md)
- [MenuItem.SetItalic](MenuItemSetItalic.md)
- [MenuItem.SetState](MenuItemSetState.md)
- [MenuItem.SetTitle](MenuItemSetTitle.md)

### Example Databases

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

### FileMaker Magazin

- [Ausgabe 2/2021, Seite 29](https://filemaker-magazin.de/neuigkeit/4132-Appetithappen-FMM_202102)

This function is free to use.

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

  
[MenuItem.SetBold](MenuItemSetBold.md) - [MenuItem.SetEvaluate](MenuItemSetEvaluate.md)

[HTML Version](MenuItemSetEnabled.shtml)