|
WikiDoc |
The [menuRef] command
IntroductionThe [menuRef] command lets you create and manipulate menus in Alpha. Menu items can be manipulated using the new [menuItem] command (see the MenuItemCommand page on this wiki). Both commands could constitute a replacement for the old [Menu] command. SynopsisThe formal syntax of the [menuRef] command is: menuRef subcommand ?options? The possible subcommands are described below. Depending on the subcommand, various options can be additionnally specified. The [clear] subcommandThis subcommand removes all the items from a menu. The syntax is: menuItem clear token To remove only one item from a menu list, use the [menuRef delete] command. The [count] subcommandThis subcommand returns the number of menu items in a menu. The syntax is: menuItem count token The [create] subcommandThis subcommand creates a new menu. It accepts a few options. The complete syntax is:
menuRef create ?-attributes val? ?(-icon code|-title name)? ?-command name?
The [menuRef create] command returns a token used in the other subcommands (as well as with the [menuItem] command) to uniquely identify the menu. Here is the description of the various options:
The [delete] subcommandThis subcommand lets you delete a menu. The syntax is: menuRef delete token The token associated with this menu is not valid anymore and is removed from the list returned by the [menuRef list] command. The [hilite] subcommandThis subcommand lets you hilite/unhilite a menu. The syntax is: menuRef hilite token (0|1) The [insert] subcommandThis subcommand lets you insert a menu in the menu bar. The syntax is: menuRef insert token ?-before token? The -before option lets you specify the token of another menu before which the menu must be inserted in the menu bar. If unspecified, the menu is appended at the right of the menu bar (yet before the Help menu). The [items] subcommandThis subcommand returns a list of all the items currently present in the menu, in the index order. The syntax is: menuRef items token This command should not be confused with the [menuRef list] command which returns the current list of menus. The [list] subcommandThis subcommand returns a list of the tokens corresponding to the currently existing menus. Each time a new menu is created, its token is appended at the end of the list, so this list is ordered from the oldest to the newest menu. The syntax is: menuRef list The [remove] subcommandThis subcommand lets you remove a menu from the menu bar. The syntax is:
menuRef remove token
The menu is removed but not deleted: its token remains valid. The [set] subcommandThis subcommand lets you get or set some properties of a menu. The syntax can take two forms:
menuRef set token option
menuRef set token option value ?option value...?
In the first form the command returns the current value of the specified option. In the second form, it lets you set the value of one or several options. The available options are exactly the same as with the [menuRef create] command. Application menusThere are two special menus provided by the system: the application menu (which starts with the About Alpha item) and the help menu. Both menus can be targetted by the [menuRef] and [menuItem] commands using the "application" and "help" symbolic names in place of the token. For instance:
menuRef count help
The application also provides a symbolic token "contextual" to designate the contextual menu which is displayed when the user control-clicks on a document window (see the ContextualModules page on this wiki). These menus cannot be deleted or removed using the [menuRef delete] and [menuRef remove] commands. ExamplesSee a series of sample instructions on the MenuItem Command page on this wiki. (add your comments here...) |
|
Edit -
History -
Print -
Recent Changes -
Search
Page last modified on September 30, 2009, at 09:03 AM
|
Hosted on
|