CNS Menu

Dynamic Menus

<- Back to CNS Menu function list

CNSMenu_DefineQuickMenu

Description

This function allows you to easily create a menu without using xml.

Return Type
Text
Format
CNSMenu_DefineQuickMenu ( Name ; Items ; Script ; DB ; FailScript ; FailDB ; Persistent ; IgnoreMetaTags ; BGColor ; FGColor )
Required Parameters
  • Name

    The Name for the Menu.

  • Items

    The Return-Separated list of Items for the Menu. Each line represents one item on the menu. You can specify a 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 name "Blue" and when a user selected that item, the value "0000FF" would be returned to 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.
    • ` - 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)
    • * - the item will appear with a bullet mark. (On Mac, you can also use opt-8 to type an actual bullet mark)
    • + - 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.

    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 either set the "IgnoreMetaTags" parameter to true, or 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.

Optional Parameters
  • Script

    The Script to call when an Item is selected.

  • DB

    The Database that contains the Script to call. (The database that calls this function is used by default.)

  • FailScript

    The Script to call if the user clicks off the menu without selecting anything. (Default is to do nothing.)

  • FailDB

    The DB that contains the FailScript. (Default is the same as the DB parameter.)

  • Persistent

    The QuickMenu will be saved between FileMaker Pro sessions. (Default is false.)

  • IgnoreMetaTags

    Disables processing of the special characters that define modifier keys, style, and marks. (Default is false.)

  • BGColor

    Defines the background color of items on the menu. See the menuitem XML Tag definition for an explanation of how to define the color.

  • FGColor

    Defines the foreground/font color of items on the menu. See the menuitem XML Tag definition for an explanation of how to define the color.

Related Items
CNSMenu_DefineMenu, CNSMenu_DefineMenuFile
Example

Code:

CNSMenu_DefineQuickMenu("ColorsMenu";"Red;1¶Blue;2¶Yellow;3")

Result:

Creates a menu named "ColorsMenu" with a Red item with a value of 1, Blue item with a value of 2, and a Yellow item with a value of 3.