uitree
Creates a hierarchy in the graphical user interface.
Syntax
h = uitree()
h = uitree(property, value...)
h = uitree(parent, property, value, ...)
Inputs
- parent
- Optional handle of a container object, which could be a figure, uipanel, uitab or uicontrol of style uibuttongroup. If no handle is given, current figure is used as the parent.
- property, value
-
- 'backgroundcolor'
- Specifies the background color. Color can be specified as a real vector specifying RGB values in the range 0-255 or 0-1.
- 'callback'
- Callback function that is triggered by a single mouse click on h. If value is a function handle, it must be a function that takes at least two arguments. The first argument is the handle of the uicontrol. The second argument is the event data to the uicontrol. OML passes empty data to the second argument if there is no data to the uicontrol. If value is a string, it must represent a function handle or a function name. If value is a cell, it must contain the function name/function handle in the first cell element and parameters to pass to callback function in the additional elements.
- 'createfcn'
- Function that is triggered when h is created. If value is a function handle, it must be a function that takes at least two arguments. The first argument is the handle of the uicontrol. The second argument is the event data to the uicontrol, which is ignored for createfcn. If value is a string, it must represent a function handle or a function name. If value is a cell, it must contain the function name/function handle in the first cell element and parameters to pass to callback function in the additional elements. After it is executed, createfcn cannot be interrupted.
- 'deletefcn'
- Function that is triggered when h is deleted. If value is a function handle, it must be a function that takes at least two arguments. The first argument is the handle of the uicontrol. The second argument is the event data to the uicontrol, which is ignored for createfcn. If value is a string, it must represent a function handle or a function name. If value is a cell, it must contain the function name/function handle in the first cell element and parameters to pass to callback function in the additional elements. After it is executed, createfcn cannot be interrupted.
- 'enable'
- Specifies if h is enabled. Valid values are 'on'(default) and 'off'.
- 'expand'
- Specifies if h is expanded. Valid values are 'on'(default) and 'off'.
- 'fontangle'
- Specifies the angle of the displayed font. Valid values are 'regular'(default) and 'italic'.
- 'fontname'
- Specifies the name of the displayed font.
- 'fontsize'
- Specifies the size of the displayed font.
- 'fontweight'
- Specifies the weight of the displayed font in all tabs. Valid values are 'normal'(default) and 'bold'.
- 'foregroundcolor'
- Specifies the foreground color. Valid values are 'transparent' or a real vector specifying RGB values in the range 0-255 or 0-1.
- 'iconpath'
- Path to the icon of the root node.
- 'interruptible'
- Specifies if the callback associated with h is interruptible by the user by clicking on the Stop button in the user interface. Valid values are 'off' (default) and 'off'.
- 'keypressfcn'
- Function that is triggered when there is a key is pressed on h. If value is a function handle, it must be a function that takes two arguments. The first argument is the handle of the uicontrol. The second argument is the event data to the uicontrol, which has details on the key pressed. If value is a string, it must represent a function handle or a function name. If value is a cell, it must contain the function name/function handle in the first cell element and parameters to pass to the function in the additional elements.
- 'parent'.
- Specifies the parent handle. This should be a container object like a figure, uipanel, uitab or uicontrol of style buttongroup.
- 'position'
- Position and size of h. Value is specified as a vector of form: [left top width height]. If 'units' has a value of 'normalized', values must be between 0 to 1.
- 'tag'
- User-defined string to tag graphical control objects.
- 'tooltipstring'
- Tooltip to display.
- 'text'
- Text displayed for the root node of h. If no value is specified, the text displayed is 'Root'.
- 'units'
- Specifies units of measurement. Valid values are 'pixels'(default) and 'normalized'.
- 'userdata'
- User-defined numerical data.
- 'value'
- User-defined scalar data.
- 'visible'
- Specifies if h is visible. Valid values are 'on'(default) and 'off'.
Outputs
- h
- Handle of the uitree created.
Example
h = uitree('text', 'My Tree', 'iconpath', 'msfolder.png', 'foregroundcolor', 'blue', ...
'fontweight', 'bold');
% Internal node with properties
node1 = uitreenode(h, 'iconpath', 'mslist.png', 'text', 'Node1', 'fontangle', 'italic');
% Default internal node
node2 = uitreenode(h);
set(node2, 'enable', 'off');
% Leaf node
leafnode = uitreenode(node2, 'text', 'Leaf Node');