Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Menu.AddItems
Adds a couple of menu items.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Menu | 4.1 | ✅ Yes | ✅ Yes | ❌ No | ❌ No | ❌ No |
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
menu | The reference to the menu. Please create one with Menu.CreateMenu. | $menu | |
titles | The list of titles for new menu items. | "Hello" | |
tags | The tags for the entries. | Optional |
Result
Returns OK or error.
Description
Adds a couple of menu items.If the list of titles includes a line with "-" the plugin version 4.5 and newer will use a separator for this item.
Examples
Add two items
MBS( "Menu.AddItems"; $menu; "Hello¶World" )
Add two items with tags
MBS( "Menu.AddItems"; $menu; "Hello¶World"; "11¶12" )
QuickMenu custom function:
/* Parameters: Items */
Let ( [
/* Create a menu */
menu = MBS( "Menu.CreateMenu" );
/* add items from our parameter */
m2 = MBS( "Menu.AddItems"; menu; Items );
/* show menu at mouse position */
m3 = MBS( "Menu.PopUp"; menu; "mouse"; 0; 0 );
/* query selected item */
selectedItem = MBS( "Menu.SelectedItem"; menu );
/* if something is selected, query its text */
result = If( Length(selectedItem )>0; MBS( "MenuItem.GetTitle"; selectedItem ); "");
/* Cleanup menu */
m5 = MBS( "Menu.Release"; menu; 1 )
];
/* return selection */
result )
QuickMenu custom function with tags
/* Parameters: Items, Tags */
Let ( [
/* Create a menu */
menu = MBS( "Menu.CreateMenu" );
/* add items from our parameter */
m2 = MBS( "Menu.AddItems"; menu; Items; Tags );
/* show menu at mouse position */
m3 = MBS( "Menu.PopUp"; menu; "mouse"; 0; 0 );
/* query selected item */
selectedItem = MBS( "Menu.SelectedItem"; menu );
/* if something is selected, query its text */
result = If( Length(selectedItem )>0; MBS( "MenuItem.GetTag"; selectedItem ); "");
/* Cleanup menu */
m5 = MBS( "Menu.Release"; menu; 1 )
];
/* return selected tag */
result )
See also
- Menu.AddItem
- Menu.CreateMenu
- Menu.PopUp
- Menu.Release
- Menu.SelectedItem
- MenuItem.GetTag
- MenuItem.GetTitle
Example Databases
Blog Entries
FileMaker Magazin
This function checks for a license.
Created 18th August 2014, last changed 1st December 2014