Product Logo

CNS Menu

Dynamic Menus

JSON

menu Object

Namemenu Object
Description

An object with a “type” value of “menu” is the main object for all menu definitions. You need to define at least the “name” value to have a valid “menu” object. This object has an “items” array that can contain “menuitem”, “submenu”, and “insertmenu” objects.

Format
{ "type" : "menu", "name" : "menu name to insert", "action" : "update", "defaultdb" : "mydb", "defaultscript" : "myscript", "defaultvalue" : "47", "modifierkeys" : "shift+ctrl", "faildb" : "mydb", "failscript" : "myfailscript", "defaultbgcolor" : "#FFFF00", "defaultfgcolor" : "#000" }
Required Values
  • "name"
    Defines the name of this menu. You use this name when telling CNS Menu to display the menu, when deleting the menu, or when inserting the menu into another menu.
Optional Values
  • "action"
    Defines whether or not this is a new menu or an update to an existing menu. Specify either "new" or "update". The default value is "new".
  • "defaultdb"
    Defines the default database for all the menu items contained in this menu. If you do not specify a database when defining a menu item, this default database will be used. The default value is "".
  • "defaultscript"
    Defines the default script for all the menu items contained in this menu. If you do not specify a script when defining a menu item, this default script will be used. The default value is "".
  • "defaultvalue"
    Defines the default value for all the menu items contained in this menu. If you do not specify a value when defining a menu item, this default value will be used. The default value is "".
  • "modifierkeys"
    Defines the modifier keys that are required in order to show the menu. 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 you call CNSMenu_ShowMenu, then the menu will not be shown. Instead, the default script will be called in the default database. 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".
  • "faildb"
    Defines the database that contains the fail script. If the failscript attribute is defined, but this attribute is not, the plug-in will use the current database. The default value is "".
  • "failscript"
    Defines the script the plug-in calls if the user clicks off the menu without selecting anything. The default value is "".
  • "defaultbgcolor"
    Defines the default background color of items on the menu. See the "menuitem" Object for an explanation of how to define the color. The default color is defined by the system.
  • "defaultfgcolor"
    Defines the foreground/font color of items on the menu. See the "menuitem" Object for an explanation of how to define the color. The default color is defined by the system.