Product Logo

CNS Menu

Dynamic Menus

JSON

menuitem Object

Namemenuitem Object
Description

An object with a “type” value of “menuitem” is used to define a single item on the menu or submenu. You need to at least define the “name” value to have a valid “menuitem” object.

Format
{ "type" : "menuitem", "name" : "item name" "db" : "mydb", "script" : "myscript", "value" : "47", "enabled" : true, "groupid" : "abc", "modifierkeys" : "shift+ctrl", "style" : "bold", "mark" : "check", "bgcolor" : "#FFFF00", "fgcolor" : "#000" }
Required Values
  • "name"
    Defines the name of the menu item. This name appears on the menu. If the name is defined as "-", a separator will be placed at this location in the menu instead of a normal menu item. If you are defining a menu separator, only the "groupid" and "modifierkeys" values will be used; all others will be ignored. The name of the chosen menu item can be retrieved using the CNSMenu_GetMenuChoice function.
Optional Values
  • "db"
    Defines the database that contains the script for this menu item. If this is not defined, the default database from the parent submenu or menu will be used. If the parent submenu or menu does not have a database defined, the current database will be used. The default value is "".
  • "script"
    Defines the script to be called when the user selects this menu item. If this is not defined, the default script from the parent submenu or menu will be used. The default value is "".
  • "value"
    Defines a user-supplied value for this menu item. This value can be retrieved using the CNSMenu_GetMenuValue function and will also be the "Script Parameter" if a script is called. The default value is "".
  • "enabled"
    Defines whether or not this menu item is enabled. Specify either true or false. If the menu item is disabled, it will appear greyed and the user will not be able to select it. The default value is true.
  • "groupid"
    Defines a user-supplied group identifier for this menu item. This is used in conjunction with the "modifierkeys" value to selectively show alternative menu items depending on which modifier keys are held down. See the Hidden Items Example in the CNS Menu example database for examples that use this attribute. The default value is "".
  • "modifierkeys"
    Defines the modifier keys that are required in order to show this menu item. Specify "none" or "shift", "ctrl", "opt", "cmd", or combinations using the plus sign (eg. "shift+ctrl+cmd"). If the specified modifier keys are not held down when this menu is shown, this menu item will not be shown. If you are making a cross-platform solution, you will only want to use the "ctrl" and "shift" modifier keys because windows does not have the "opt" and "cmd" keys. The default value is "none".
  • "style"
    Defines the font style of this menu item. Specify "none" or "bold", "italic", "underline", or combinations using the plus sign (eg. "bold+italic"). The default value is "none".
  • "mark"
    Defines the mark for this menu item. Specify "none", "check", "bullet", or "diamond". The mark is displayed to the left of the menu item. The default value is "none".
  • "bgcolor"
    Defines the background color of the item. The color is defined using an HTML Hex Color like "#12AB0F". Those are 3 hexidecimal digits ranging from 00 to FF for each of the Red, Green, and Blue values. You can also use the CSS short hand of "#C0F" which is the same as saying "#CC00FF". If you are not familiar with HTML Colors, searching the internet will come up with a wealth of information. The default color is defined by the system.
  • "fgcolor"
    Defines the foreground/font color of the item. See the bgcolor value above for an explanation of how to define the color. The default color is defined by the system.