Menu.CreateMenu
---------------

Creates a menu.

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

MBS( "Menu.CreateMenu" { ; Title } ) 

**MBS**( **"Menu.CreateMenu";** /\* Creates a menu. \*/  
**$Title**) /\* Optional; The title for the menu.e.g. "Hello" \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| Title | The title for the menu. | "Hello" | Optional |

### Result

Return menu reference or error.

### Description

Creates a menu.  
You need to later release it with [Menu.Release](MenuRelease.md) function.  
Menu reference numbers are starting at 10000 and counting up for each new menu.  
### Examples

Show a context menu based on a table with menu entries:

 # go to layout with menu entries   
Go to Layout \[ “REP” (REP Reports) \]  
\# this script can be called with various groups   
Set Variable \[ $type ; Value: Get(ScriptParameter) \]   
\# make a new menu   
Set Variable \[ $menu ; Value: MBS ( "Menu.CreateMenu") \]   
\# loop over records   
Go to Record/Request/Page \[ First \]  
Loop  
 # if group matches  
 If \[ REP Reports::Group = $type \]   
 # add new menu item with title from table  
 Set Variable \[ $item ; Value: MBS ( "[MenuItem.CreateMenuItem](MenuItemCreateMenuItem.md)"; REP Reports::LabelReport ) \]   
 # define which script to call if menu item is selected  
 Set Variable \[ $r ; Value: MBS ( "[MenuItem.SetScriptAction](MenuItemSetScriptAction.md)"; $item ; Get(FileName); REP Reports::Script ) \]   
 # add item to menu  
 Set Variable \[ $r ; Value: MBS ( "[Menu.AddItem](MenuAddItem.md)"; $menu ; $item ) \]   
 End If  
 # next record?  
 Go to Record/Request/Page \[ Next ; Exit after last \]   
End Loop  
\# switch layout back   
Go to Layout \[ original layout \]  
\# Show menu   
Set Variable \[ $r ; Value: MBS ( "[Menu.PopUp](MenuPopUp.md)"; $menu ; "mouse") \]   
\# Cleanup memory   
Set Variable \[ $r ; Value: MBS ( "[Menu.Release](MenuRelease.md)"; $menu ) \]  
### See also

- [Menu.SetAllowsContextMenuPlugIns](MenuSetAllowsContextMenuPlugIns.md)
- [Menu.SetScriptAction](MenuSetScriptAction.md)
- [Menu.SetShowsStateColumn](MenuSetShowsStateColumn.md)
- [Menu.SetTag](MenuSetTag.md)
- [Menu.SetURL](MenuSetURL.md)
- [MenuItem.CreateMenuItem](MenuItemCreateMenuItem.md)
- [MenuItem.GetTag](MenuItemGetTag.md)
- [MenuItem.SetBold](MenuItemSetBold.md)
- [MenuItem.SetItalic](MenuItemSetItalic.md)
- [MenuItem.SetScriptAction](MenuItemSetScriptAction.md)

### Example Databases

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

### Blog Entries

- [Evaluate vs. Script Trigger](https://www.mbsplugins.de/archive/2016-03-04/Evaluate_vs_Script_Trigger/monkeybreadsoftware_blog_filemaker)
- [Tip of the day: Build contextual menu in FileMaker from a table](https://www.mbsplugins.de/archive/2015-09-11/Tip_of_the_day_Build_contextua/monkeybreadsoftware_blog_filemaker)
- [Colors for Menus in FileMaker](https://www.mbsplugins.de/archive/2015-05-02/Colors_for_Menus_in_FileMaker/monkeybreadsoftware_blog_filemaker)
- [QuickMenu function](https://www.mbsplugins.de/archive/2014-12-01/QuickMenu_function/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

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

This function checks for a license.

Created 18th August 2014 , last changed 11st September 2015

  
[Menu.AddItems](MenuAddItems.md) - [Menu.DefineQuickMenu](MenuDefineQuickMenu.md)

[HTML Version](MenuCreateMenu.shtml)