Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides   Examples
New in version: 6.2   6.3   6.4   6.5   7.0   7.1   7.2   7.3   7.4   7.5    Statistic  

Menu.AddItems

Adds a couple of menu items.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
Menu 4.1 Yes Yes No No No

MBS( "Menu.AddItems"; menu; titles { ; tags } )

Parameters

Parameter Description Example value
menu The reference to the menu. Please create one with Menu.CreateMenu. $menu
titles The list of titles for new menu items. "Hello"
tags Optional
The tags for the entries.

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

Example Databases


Menu.AddItem   -   Menu.CreateMenu

Feedback: Report problem or ask question.




Links
MBS FileMaker tutorial videos