<- Back to CNS Menu function list
XML: menu Tag
- Description
This tag is the main tag for all menu definitions. You need to define at least the name attribute to have a valid <menu> tag. This tag can contain <menuitem>, <submenu>, and <insertmenu> tags.
- Format
- <menuname="menu name to insert"action="update"defaultdb="mydb"defaultscript="myscript"defaultvalue="47"modifierkeys="shift+ctrl"faildb="mydb"failscript="myfailscript"defaultbgcolor="#FFFF00"defaultftcolor="#000"/>
- Required Attributes
- 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.
- name
- Optional Attributes
- 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 ("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 Tag 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 Tag for an explanation of how to define the color. The default color is defined by the system.
- action
- Related Items
- XML: insertmenu Tag, XML: menuitem Tag, XML: submenu Tag
- Examples
Example 1
Code:
<menu name="test">Result:
Defines a menu named "test".Example 2
Code:
<menu name="test" action="update">Result:
Updates the menu named "test".Example 3
Code:
<menu name="menu" failscript="Clear field">Result:
Defines a menu named "menu" which will call the script named "Clear field" in the current database if the user clicks off the menu without selecting anything.Example 4
Code:
<menu name="menu" defaultdb="test" defaultscript="find all" modifierkeys="ctrl">Result:
Defines a menu named "menu", whose menu items will use the "find all" script in the "test" database unless those menu items define their own script and/or database. If the Control key is not held down when the CNSMenu_ShowMenu function is called, the "find all" script in the "test" database will be called instead of showing the menu.