Product Logo

CNS Menu

Dynamic Menus

JSON

updatemenuitem Object

Nameupdatemenuitem Object
Description

An object with a “type” value of “updatemenuitem” allows you to update the values of any menu item on any menu you have previously defined. The “updatemenuitem” object is useful for enabling a previously disabled menu item (or vice versa), placing a mark next to an item, or changing any other value assocated with a menu item. This object is used by itself and does not need to appear within the “menu” or “submenu” objects. This object is an almost exact replica of the “menuitem” object, except that instead of specifying just the name of the menu item, you must specify the “path” to the menu item so that CNS Menu knows which item to update. Only those values that you define will replace the original menu item’s values. You need to at least define the “name” value to have a valid “updatemenuitem” object.

Format
{ "type" : "updatemenuitem", "name" : "path to menu item", "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 "path" to the menu item that you are updating. The "path" is made up of the menu name, followed by any submenu names, followed by the actual name of the menu item, all separated by the forward-slash, and looks like "menu name/submenu name/menu item name".
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 default database, the current database will be used. If the value is missing, the original "database" value will be unchanged; if the value exists, but is set to "", the original "database" value will be cleared.
  • "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. If the value is missing, the original "script" value will be unchanged; if the value exists, but is set to "", the "original" script value will be cleared.
  • "value"
    Defines a user-supplied value for this menu item. This value can be retrieved using the CNSMenu_GetMenuValue function and is also the "Script Parameter" if a script is called. If the json value is missing, the original menu item "value" will be unchanged; if the json value exists, but is set to "", the original menu item "value" will be cleared.
  • "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. If the value is missing, the original "enabled" value will be unchanged.
  • "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. If the value is missing, the original "groupid" value will be unchanged; if the value exists, but is set to "", the original "groupid" value will be cleared.
  • "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. If the value is missing, the original "modifierkeys" value will be unchanged; if the value is "none", the original "modifierkeys" value will be cleared.
  • "style"
    Defines the font style of this menu item. Specify "none" or "bold", "italic", "underline", or combinations using the plus sign (eg. "bold+italic"). If the value is missing, the original "style" value will be unchanged; if the value is "none", the original "style" value will be cleared.
  • "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. If the value is missing, the original "mark" value will be unchanged; if the value is "none", the original "mark" value will be cleared.
  • "bgcolor"
    Defines the background color of the item. See the "menuitem" Object for an explanation of how to define the color. If the value is missing, the original "bgcolor" value will be unchanged; if the value exists, but is set to "", the original "bgcolor" value will be cleared.
  • "fgcolor"
    Defines the foreground/font color of the item. See the "menuitem" Object for an explanation of how to define the color. If the value is missing, the original "fgcolor" value will be unchanged; if the value exists, but is set to "", the original "fgcolor" value will be cleared.