Product Logo

CNS Menu

Dynamic Menus


insertmenu Object

Nameinsertmenu Object

An object with a “type” value of “insertmenu” allows you to insert any menu into another menu when that menu is displayed. The menu you are inserting does not have to be defined when you define the parent menu (the one you are inserting into), but it does need to be defined by the first time you display the parent menu. The items from the inserted menu are inserted directly into the parent menu. If you want to insert the menu as a sub menu, you must add a “submenu” object and put this object in the “items” array of that “submenu” object. If none of the menu items from the menu you are inserting have databases and/or scripts defined, then the parent menu’s default database and default script will be used. You need to at least define the “name” value to have a valid “insertmenu” object. This object has three values (besides the “type” value), one of which is required.

{ “type” : “insertmenu”, “name” : “menu name to insert”, “groupid” : “abc”, “modifierkeys” : “ctrl+shift” }
Required Values
  • “name”
    Defines the name of the menu you want to insert. When you show the parent menu, this name must equal a name of another menu you have defined.
Optional Values
  • “groupid”
    Defines a user-supplied group identifier for this inserted menu. 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. Default value is “”.
  • “modifierkeys”
    Defines the modifier keys that are required in order to insert this 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 the parent menu is shown, this menu will not be inserted. 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. Default value is “none”.