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.0   6.1   6.2   6.3   6.4   6.5   7.0   7.1   7.2   7.3    Statistic  

Menu.DefineQuickMenu

Builds a new menu from a definition text with menu items.

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

MBS( "Menu.DefineQuickMenu"; Name; Definition )

Parameters

Parameter Description Example value
Name The title of the new menu. "MainMenu"
Definition The menu definition. "Red;1¶Blue;2¶Yellow;3"

Result

Returns menu reference or error.

Description

Builds a new menu from a definition text with menu items.
This function allows you to easily create a menu with a definition. The first two parameters are required. The "Name" parameter is the name of the menu.
The "Definition" parameter is a return-delimited list of menu items for this menu. Each line represents one item on the menu. You can specify a tag value for a menu item by appending a semi-colon and the value onto the end of the item name. For example, if you had "Blue;0000FF" on a line, your menu would have an item with the title "Blue" and when a user selected that item, the tag value "0000FF" could be used for your script. For sub-menus, specify the name of the sub-menu, followed by a greater-than sign (">") followed by the next sub-menu name or menu item. For example, if you had "Colors>Red" on a line, your menu would have a sub-menu named "Colors" with an item inside named "Red". Every sub-menu and menu item can be preceded with one or more special "meta tags" to specify different styles and marks for the sub-menu or item name as explained below:

!The item will appear disabled.
$The item will require the shift key to be pressed in order to show up.
^The item will require the control key to be pressed in order to show up.
~The item will require the alt/option key to be pressed in order to show up. (this is the tilde character, which is shifted version of the key to the left of the 1 on English keyboards) (only available on Mac)
@The item will require the command key to be pressed in order to show up. (only available on Mac)
#The item will appear bold.
%The item will appear italicized.
_ The item will appear underlined.
` or √The item will appear with a check mark. (this is the backtick character, which is the key to the left of the 1 on English keyboards) (on Mac, you can also use opt-v to type an actual check mark)
* or •The item will appear with a bullet mark. (On Mac, you can also use opt-8 to type an actual bullet mark)
+ or ◊The item will appear with a diamond mark. (On Mac, you can also use shift-opt-v to type an actual diamond mark)
=disable the meta tag processing for the rest of the sub-menu or item name.
-The item is a separator.

You can specify more than one of the above for any item to set multiple attributes at once, with the exception of the check mark, bullet mark, and diamond mark. You can only have one mark defined for a menu item. For example, if you had "!#%Delete Record" on a line, your menu would have an item with the name "Delete Record" that appeared disabled, bold, and italicized. If you need to display a menu item that starts with one of these "meta tags", you can use the equals ("=") meta tag to skip the meta tag processing for the item. For example, if you had "=$4.00" on a line, your menu would have an item with the name "$4.00" instead of a menu named "4.00" that required you to press the shift key in order to make the item visible.

Not all features available on Windows!

With 5.2 plugin the name of the menu also defines the identifier to use. You can leave name empty to use reference number provided by plugin.

Examples

Define a menu:

MBS( "Menu.DefineQuickMenu"; "ColorsMenu" ; "Red;1¶Blue;2¶Yellow;3" )

Define a menu with submenus:

MBS( "Menu.DefineQuickMenu"; "ColorsMenu"; "Warm colors>Red¶Warm colors>Yellow¶Warm colors>Orange¶Cool colors>Blue¶Cool colors>Green¶Cool colors>Purple")

Define a menu with checkmark:

MBS( "Menu.DefineQuickMenu"; "Current Fruit"; "Banana;Cherry;`Grape;Orange" )

Choose from menu with one Let statement:

// show menu with one let statement
Let ( [
// some list of menu entries
valuelist = "xxx¶yyy¶zzz" ;
// create menu from definition
menu = MBS ( "Menu.DefineQuickMenu"; "x" ; valuelist ) ;
// show menu near mouse
result = MBS ( "Menu.PopUp" ; menu ; "mouse" ) ;
// query selected item number
item = IF ( result = 1 ; MBS("Menu.SelectedItem"; menu) ) ;
// query title for that item
title = IF ( Length ( item > 0 ) ; MBS ( "MenuItem.GetTitle" ; item ) ) ;
// release memory
r = MBS ( "Menu.Release"; menu ) ] ;
// return the selected title
title )

See also

Example Databases


Menu.CreateMenu   -   Menu.DefineQuickMenuXML

Feedback: Report problem or ask question.




Links
MBS Xojo tutorial videos