Menu.PopUp
----------

Pops up the menu at the specified location.

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

MBS( "Menu.PopUp"; menu; Mode { ; X; Y; window; Item; objectName } ) 

**MBS**( **"Menu.PopUp";** /\* Pops up the menu at the specified location. \*/  
**$menu**; /\* The reference to the menu. Please create one with [Menu.CreateMenu](MenuCreateMenu.md). \*/   
**$Mode**; /\* The mode to use.   
Can be "mouse", "screen", "object" or "window".   
Default is mouse for leaving away the parameter or passing empty text.  
Version 8.3 adds mode "content" to make it relative to the content part of the window, below toolbars.e.g. "mouse" \*/   
**$X**; /\* Optional; The relative x coordinates for the position relative to the mouse, screen or window.e.g. 0 \*/   
**$Y**; /\* Optional; The relative y coordinates for the position relative to the mouse, screen or window.e.g. 0 \*/   
**$window**; /\* Optional; The window reference for the showing menu relative to a window. \*/   
**$Item**; /\* Optional; The menu item to be positioned at the specified location in the view.  
macOS only. \*/   
**$objectName**) /\* Optional; The object name for mode=object.e.g. "web" \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| menu | The reference to the menu. Please create one with [Menu.CreateMenu](MenuCreateMenu.md). | $menu |  |
| Mode | The mode to use.    Can be "mouse", "screen", "object" or "window".    Default is mouse for leaving away the parameter or passing empty text.   Version 8.3 adds mode "content" to make it relative to the content part of the window, below toolbars. | "mouse" |  |
| X | The relative x coordinates for the position relative to the mouse, screen or window. | 0 | Optional |
| Y | The relative y coordinates for the position relative to the mouse, screen or window. | 0 | Optional |
| window | The window reference for the showing menu relative to a window. | $window | Optional |
| Item | The menu item to be positioned at the specified location in the view.   macOS only. | $item | Optional |
| objectName | The object name for mode=object. | "web" | Optional |

### Result

Returns 1, 0 or error.

### Description

Pops up the menu at the specified location.  
The top left corner of the specified item (if specified, item must be present in the receiver) is positioned at the specified location in the specified view, interpreted in the view's own coordinate system.  
If you call this on the server for Web Direct, the menu will show on the server, not in the browser.  
Returns 1 if item was selected or 0 if not.  
If you like to show a context menu only when user did a right mouse click, you can use the [EventMonitor.LastMouseClickButton](EventMonitorLastMouseClickButton.md) function to check mouse state.  
### 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](MenuCreateMenu.md)") \]   
\# 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"; $menu ; "mouse") \]   
\# Cleanup memory   
Set Variable \[ $r ; Value: MBS ( "[Menu.Release](MenuRelease.md)"; $menu ) \]  
Show menu and show selection:

 Set Variable \[$menu ; Value:MBS ("[Menu.CreateMenu](MenuCreateMenu.md)")\]  
\# create menu items...   
Set Variable \[$item ; Value:MBS ("[MenuItem.CreateMenuItem](MenuItemCreateMenuItem.md)"; "Hello World")\]  
Set Variable \[$r ; Value:MBS ("[MenuItem.SetTag](MenuItemSetTag.md)"; $item ; "secret value")\]  
Set Variable \[$r ; Value:MBS ("[Menu.AddItem](MenuAddItem.md)"; $menu ; $item )\]  
\#   
\#show menu   
Set Variable \[$m ; Value:MBS ("Menu.PopUp"; $Menu ; "mouse")\]  
\#   
\#you selected something?   
If \[$m = 1\]  
 Set Variable \[$selectedItem ; Value:MBS ("[Menu.SelectedItem](MenuSelectedItem.md)"; $menu )\]  
 Set Variable \[$selectedTitle ; Value:MBS ("[MenuItem.GetTitle](MenuItemGetTitle.md)"; $selectedItem )\]  
 Set Variable \[$selectedTag ; Value:MBS ("[MenuItem.GetTag](MenuItemGetTag.md)"; $selectedItem )\]  
 #  
 Show Custom Dialog \["Auswahl"; $selectedItem &amp; ¶ &amp; $selectedTitle &amp; ¶ &amp; $selectedTag \]  
End If  
Set Variable \[$m ; Value:MBS ("[Menu.Release](MenuRelease.md)"; $Menu ; 1)\]  
Choose from menu with one Let statement:

 Let ( \[   
// show menu with one let statement  
  
// some list of menu entries  
valuelist = "xxx¶yyy¶zzz" ;  
// create menu from definition  
menu = MBS ( "[Menu.DefineQuickMenu](MenuDefineQuickMenu.md)"; "x" ; valuelist ) ;  
// show menu near mouse  
result = MBS ( "Menu.popup" ; menu ; "mouse" ) ;  
// query selected item number  
item = IF ( result = 1 ; MBS ("[Menu.SelectedItem](MenuSelectedItem.md)"; menu) ) ;  
// query title for that item  
title = IF ( Length ( item &gt; 0 ) ; MBS ( "[MenuItem.GetTitle](MenuItemGetTitle.md)" ; item ) ) ;  
// release memory  
r = MBS ( "[Menu.Release](MenuRelease.md)"; menu ) \] ;   
// return the selected title  
title )  
Run menu at logo object:

 MBS ("Menu.PopUp"; $Menu ; "object"; 0; 0; Get(WindowName); ""; "logo")  
### See also

- [EventMonitor.LastMouseClickButton](EventMonitorLastMouseClickButton.md)
- [Menu.AddItem](MenuAddItem.md)
- [Menu.AddItems](MenuAddItems.md)
- [Menu.CreateMenu](MenuCreateMenu.md)
- [Menu.Release](MenuRelease.md)
- [Menu.SelectedItem](MenuSelectedItem.md)
- [MenuItem.CreateMenuItem](MenuItemCreateMenuItem.md)
- [MenuItem.GetTag](MenuItemGetTag.md)
- [MenuItem.GetTitle](MenuItemGetTitle.md)
- [MenuItem.SetScriptAction](MenuItemSetScriptAction.md)

### Release notes

- **Version 15.1**
    - Improved [Menu.PopUp](https://www.mbsplugins.eu/MenuPopUp.shtml) to report an error if the item for the positioning is not in the menu.
- **Version 8.3**
    - Added new modes content and object for [Menu.PopUp](http://www.mbsplugins.eu/MenuPopUp.shtml).
    - Fixed window mode for [Menu.PopUp](http://www.mbsplugins.eu/MenuPopUp.shtml) function.

### Example Databases

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

### Blog Entries

- [MBS FileMaker Plugin, version 15.1pr6](https://www.mbsplugins.de/archive/2025-03-03/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [Seven things to add to your FileMaker solution today with MBS Plugin](https://www.mbsplugins.de/archive/2021-03-21/Seven_things_to_add_to_your_Fi/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 8.3pr2](https://www.mbsplugins.de/archive/2018-06-18/MBS_FileMaker_Plugin_version_8/monkeybreadsoftware_blog_filemaker)
- [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)
- [QuickMenu function](https://www.mbsplugins.de/archive/2014-12-01/QuickMenu_function/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin, version 4.1pr4](https://www.mbsplugins.de/archive/2014-03-09/MBS_Filemaker_Plugin_version_4/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

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

This function checks for a license.

Created 18th August 2014 , last changed 5th September 2025

  
[Menu.NumberOfItems](MenuNumberOfItems.md) - [Menu.Release](MenuRelease.md)

[HTML Version](MenuPopUp.shtml)