Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
9.3
9.4
9.5
10.0
10.1
10.2
10.3
10.4
10.5
10.6
Statistic
FMM
Blog
MenuItem.CreateMenuItem
Creates a new menu item.
| Component | Version | macOS | Windows | Linux | Server | FileMaker iOS SDK |
| Menu | 4.1 | Yes | Yes | No | No | No |
Parameters
| Parameter | Description | Example | Flags |
|---|---|---|---|
| Title | The title of the menu item. | "Hello World" | Optional |
| keyEquivalent | Optional, a string representing a keyboard key to be used as the key equivalent. | "T" | Optional |
Result
Returns menu item reference number or error.
Description
Creates a new menu item.You later need to release it with MenuItem.Release.
Menu item reference numbers are starting at 11000 and counting up for each new menu item.
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"; REP Reports::LabelReport) ]
# define which script to call if menu item is selected
Set Variable [ $r ; Value: MBS( "MenuItem.SetScriptAction"; $item; Get(FileName); REP Reports::Script ) ]
# add item to menu
Set Variable [ $r ; Value: MBS( "Menu.AddItem"; $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"; $menu) ]
See also
- MenuItem.SetBold
- MenuItem.SetFontColor
- MenuItem.SetFontName
- MenuItem.SetKeyEquivalent
- MenuItem.SetKeyEquivalentModifierMask
- MenuItem.SetRequireShift
- MenuItem.SetSubMenu
- MenuItem.SetToolTip
- MenuItem.SetUnderline
- MenuItem.SetURL
Example Databases
Blog Entries
- Evaluate vs. Script Trigger
- Tip of the day: Build contextual menu in FileMaker from a table
- Colors for Menus in FileMaker
Created 18th August 2014, last changed 11st September 2015
Menu.SetURL - MenuItem.CreateSeparator
Feedback: Report problem or ask question.
Links
MBS Xojo Plugins