Name

uimenu — Create a menu or a submenu in a figure

Calling Sequence

h=uimenu([prop1,val1] [,prop2, val2] ...)
h=uimenu(parent,[prop1, val1] [,prop2, val2] ...)

Parameters

parent

integer Handle of menu's parent

prop{1, 2 ...}

string character name of a property to set up

val{1, 2 ...}

scilab object value to affect to the corresponding property

h

integer handle of the corresponding menu

Description

This allows to create menus in a figure. If parent is a figure, then the menu item will be added to the menu bar of the figure. If parent is a menu item , then the new item will be added to the parent item, allowing to create cascaded submenu. To create a customized menu, you can use the properties listed below:

Properties

Callback

String

Instruction evaluated by the Scilab interpreter when the menu is activated. Under MacOSX, the callback will not be executed for a "button menu" (a menu without children), you must specify at least a child.

Enable

{on} | off

Enable or disable the menu. If this property is set to "on" (default), the menu is operational, but if this property is set to "off", the menu will not respond to the mouse actions and will be grayed out.

Checked

{on} | off

Menu check indicator. Setting this property to "on" (respectively "off") places (respectively removes) a check mark next to the corresponding menu item. This option can be used to create menus that indicate the state of a particular option.

Please note that a standard menu (without the option "Checked" set) has no mechanism to become a menu which will be checked by a user action and conversely.

This property is ignored for parent menus.

ForegroundColor

[1,3] real vector or string

Foreground color of the uimenu (font color). A color is specified as Red, Green and Blue values. Those values are real in [0,1]. The color can be given as a real vector, ie [R,G,B] or a string where each value is separated by a "|", ie "R|G|B".

Label

String.

This property represents the text appearing in the menu.

Tag

String

This property is generally used to identify the menu. It allows to give it a "name". Mainly used in conjunction with findobj().

Visible

{on} | off

Set the visibility of the uimenu. If this property is set to "on" (default), the uimenu is visible, but if this property is set to "off", the uimenu will not appear in its parent figure.

Examples

 
f=figure('position', [10 10 300 200]);
// create a figure
m=uimenu(f,'label', 'windows');
// create an item on the menu bar
m1=uimenu(m,'label', 'operations');
m2=uimenu(m,'label', 'quit scilab', 'callback', "exit");
//create two items in the menu "windows"
m11=uimenu(m1,'label', 'new window', 'callback',"xselect()");
m12=uimenu(m1,'label', 'clear  window', 'callback',"clf()");
// create a submenu to the item "operations"
close(f);
// close the figure
 

See Also

figure, uicontrol, set, get

Authors

Bertrand Guiheneuf