(octave.info)UI Elements
35.3 UI Elements
================
The ui* series of functions work best with the ‘qt’ graphics toolkit,
although some functionality is available with the ‘fltk’ toolkit. There
is no support for the ‘gnuplot’ toolkit.
-- : HUI = uimenu (PROPERTY, VALUE, ...)
-- : HUI = uimenu (H, PROPERTY, VALUE, ...)
Create a uimenu object and return a handle to it.
If H is omitted then a top-level menu for the current figure is
created. If H is given then a submenu relative to H is created.
uimenu objects have the following specific properties:
"accelerator"
A string containing the key combination together with CTRL to
execute this menu entry (e.g., "x" for CTRL+x).
"callback"
Is the function called when this menu entry is executed. It
can be either a function string (e.g., "myfun"), a function
handle (e.g., @myfun) or a cell array containing the function
handle and arguments for the callback function (e.g., {@myfun,
arg1, arg2}).
"checked"
Can be set "on" or "off". Sets a mark at this menu entry.
"enable"
Can be set "on" or "off". If disabled the menu entry cannot
be selected and it is grayed out.
"foregroundcolor"
A color value setting the text color for this menu entry.
"label"
A string containing the label for this menu entry. A
"&"-symbol can be used to mark the "accelerator" character
(e.g., "E&xit")
"position"
An scalar value containing the relative menu position. The
entry with the lowest value is at the first position starting
from left or top.
"separator"
Can be set "on" or "off". If enabled it draws a separator
line above the current position. It is ignored for top level
entries.
The full list of properties is documented at Note: Uimenu
Properties.
Examples:
f = uimenu ("label", "&File", "accelerator", "f");
e = uimenu ("label", "&Edit", "accelerator", "e");
uimenu (f, "label", "Close", "accelerator", "q", ...
"callback", "close (gcf)");
uimenu (e, "label", "Toggle &Grid", "accelerator", "g", ...
"callback", "grid (gca)");
See also: Note: figure.
-- : HUI = uibuttongroup (PROPERTY, VALUE, ...)
-- : HUI = uibuttongroup (PARENT, PROPERTY, VALUE, ...)
-- : uibuttongroup (H)
Create a uibuttongroup object and return a handle to it.
uibuttongroups are used to create group uicontrols.
If PARENT is omitted then a uibuttongroup for the current figure is
created. If no figure is available, a new figure is created first.
If PARENT is given then a uibuttongroup relative to PARENT is
created.
Any provided property value pairs will override the default values
of the created uibuttongroup object.
Uibuttongroup properties are documented at Note: Uibuttongroup
Properties.
Examples:
% create figure and panel on it
f = figure;
% create a button group
gp = uibuttongroup (f, "Position", [ 0 0.5 1 1])
% create a buttons in the group
b1 = uicontrol (gp, "style", "radiobutton", ...
"string", "Choice 1", ...
"Position", [ 10 150 100 50 ]);
b2 = uicontrol (gp, "style", "radiobutton", ...
"string", "Choice 2", ...
"Position", [ 10 50 100 30 ]);
% create a button not in the group
b3 = uicontrol (f, "style", "radiobutton", ...
"string", "Not in the group", ...
"Position", [ 10 50 100 50 ]);
See also: Note: figure, Note: uipanel.
-- : HUI = uicontextmenu (PROPERTY, VALUE, ...)
-- : HUI = uicontextmenu (H, PROPERTY, VALUE, ...)
Create a uicontextmenu object and return a handle to it.
If H is omitted then a uicontextmenu for the current figure is
created. If no figure is available, a new figure is created first.
If H is given then a uicontextmenu relative to H is created.
Any provided property value pairs will override the default values
of the created uicontextmenu object.
Uicontextmenu properties are documented at Note: Uicontextmenu
Properties.
Examples:
% create figure and uicontextmenu
f = figure;
c = uicontextmenu (f);
% create menus in the context menu
m1 = uimenu ("parent",c,"label","Menu item 1","callback","disp('menu item 1')");
m2 = uimenu ("parent",c,"label","Menu item 2","callback","disp('menu item 2')");
% set the context menu for the figure
set (f, "uicontextmenu", c);
See also: Note: figure, Note: uimenu.
-- : HUI = uicontrol (PROPERTY, VALUE, ...)
-- : HUI = uicontrol (PARENT, PROPERTY, VALUE, ...)
-- : uicontrol (H)
Create a uicontrol object and return a handle to it.
uicontrols are used to create simple interactive controls such as
push buttons, checkboxes, edit and list controls.
If PARENT is omitted then a uicontrol for the current figure is
created. If no figure is available, a new figure is created first.
If PARENT is given then a uicontrol relative to PARENT is created.
Any provided property value pairs will override the default values
of the created uicontrol object.
Uicontrol properties are documented at Note: Uicontrol
Properties.
Control of the type of uicontrol created is through the use of the
STYLE property. If no style property is provided, a push button
will be created.
Valid styles for uicontrol are:
"checkbox"
Create a checkbox control that allows user on/off selection.
"edit"
Create an edit control that allows user input of single or
multiple lines of text.
"listbox"
Create a listbox control that displays a list of items and
allows user selection of single or multiple items.
"popupmenu"
Create a popupmenu control that displays a list of options
that can be selected when the user clicks on the control.
"pushbutton"
Create a push button control that allows user to press to
cause an action.
"radiobutton"
Create a radio button control intended to be used for mutually
exclusive input in a group of radiobutton controls.
"slider"
Create a slider control that allows user selection from a
range of values by sliding knob on the control.
"text"
Create a static text control to display single or multiple
lines of text.
"togglebutton"
Create a toggle button control that appears like a push button
but allows the user to select between two states.
Examples:
% create figure and panel on it
f = figure;
% create a button (default style)
b1 = uicontrol (f, "string", "A Button", "position",[10 10 150 40]);
% create an edit control
e1 = uicontrol (f, "style", "edit", "string", "editable text", "position",[10 60 300 40]);
% create a checkbox
c1 = uicontrol (f, "style", "checkbox", "string", "a checkbox", "position",[10 120 150 40]);
See also: Note: figure, Note: uipanel.
-- : uipanel (PROPERTY, VALUE, ...)
-- : uipanel (PARENT, "PROPERTY, VALUE, ...)
-- : HUI = uipanel (...)
Create a uipanel object.
uipanels are used as containers to group other uicontrol objects.
If PARENT is omitted then a uipanel for the current figure is
created. If no figure is available, a new figure is created first.
If PARENT is given then a uipanel relative to PARENT is created.
Any provided property value pairs will override the default values
of the created uipanel object.
Uipanel properties are documented at Note: Uipanel Properties.
The optional return value HUI is a graphics handle to the created
uipanel object.
Examples:
% create figure and panel on it
f = figure;
p = uipanel ("title", "Panel Title", "position", [.25 .25 .5 .5]);
% add two buttons to the panel
b1 = uicontrol ("parent", p, "string", "A Button", "position",[18 10 150 36]);
b2 = uicontrol ("parent", p, "string", "Another Button", "position",[18 60 150 36]);
See also: Note: figure, Note: uicontrol.
-- : uipushtool (PROPERTY, VALUE, ...)
-- : uipushtool (PARENT, PROPERTY, VALUE, ...)
-- : HUI = uipushtool (...)
Create a uipushtool object.
uipushtools are buttons that appear on a figure toolbar. The
button is created with a border that is shown when the user hovers
over the button. An image can be set using the cdata property.
If PARENT is omitted then a uipushtool for the current figure is
created. If no figure is available, a new figure is created first.
If a figure is available, but does not contain a uitoolbar, a
uitoolbar will be created.
If PARENT is given then a uipushtool is created on the PARENT
uitoolbar.
Any provided property value pairs will override the default values
of the created uipushtool object.
Uipushtool properties are documented at Note: Uipushtool
Properties.
The optional return value HUI is a graphics handle to the created
uipushtool object.
Examples:
% create figure without a default toolbar
f = figure ("toolbar", "none");
% create empty toolbar
t = uitoolbar (f);
% create a 19x19x3 black square
img=zeros(19,19,3);
% add pushtool button to toolbar
b = uipushtool (t, "cdata", img);
See also: Note: figure, Note: uitoolbar,
Note: uitoggletool.
-- : uitoggletool (PROPERTY, VALUE, ...)
-- : uitoggletool (PARENT, PROPERTY, VALUE, ...)
-- : HUI = uitoggletool (...)
Create a uitoggletool object.
uitoggletool are togglebuttons that appear on a figure toolbar.
The button is created with a border that is shown when the user
hovers over the button. An image can be set using the cdata
property.
If PARENT is omitted then a uitoggletool for the current figure is
created. If no figure is available, a new figure is created first.
If a figure is available, but does not contain a uitoolbar, a
uitoolbar will be created.
If PARENT is given then a uitoggletool is created on the PARENT
uitoolbar.
Any provided property value pairs will override the default values
of the created uitoggletool object.
Uitoggletool properties are documented at Note: Uitoggletool
Properties.
The optional return value HUI is a graphics handle to the created
uitoggletool object.
Examples:
% create figure without a default toolbar
f = figure ("toolbar", "none");
% create empty toolbar
t = uitoolbar (f);
% create a 19x19x3 black square
img=zeros(19,19,3);
% add uitoggletool button to toolbar
b = uitoggletool (t, "cdata", img);
See also: Note: figure, Note: uitoolbar,
Note: uipushtool.
-- : uitoolbar (PROPERTY, VALUE, ...)
-- : uitoolbar (PARENT, PROPERTY, VALUE, ...)
-- : HUI = uitoolbar (...)
Create a uitoolbar object. A uitoolbar displays uitoggletool and
uipushtool buttons.
If PARENT is omitted then a uitoolbar for the current figure is
created. If no figure is available, a new figure is created first.
If PARENT is given then a uitoolbar relative to PARENT is created.
Any provided property value pairs will override the default values
of the created uitoolbar object.
Uitoolbar properties are documented at Note: Uitoolbar
Properties.
The optional return value HUI is a graphics handle to the created
uitoolbar object.
Examples:
% create figure without a default toolbar
f = figure ("toolbar", "none");
% create empty toolbar
t = uitoolbar (f);
See also: Note: figure, *note uitoggletool:
XREFuitoggletool, Note: uipushtool.
automatically generated by info2www version 1.2.2.9