uitreenode

Creates a node in a uitree hierarchy.

Syntax

h = uitreenode(parent)

h = uitreenode(parentparent, property, value, ...)

Inputs

parent
Handle of the parent which is of type uitree or uitreenode.
Type: scalar
property, value
'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.
Type: cell | functionhandle | string
'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 being executed, createfcn cannot be interrupted.
Type: cell | functionhandle | string
'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 being executed, createfcn cannot be interrupted.
Type: cell | functionhandle | string
'enable'
Specifies if h is enabled. Valid values are 'on'(default) and 'off'.
Type: string
'expand'
Specifies if h is expanded. Valid values are 'on'(default) and 'off'.
Type: string
'fontangle'
Specifies the angle of the displayed font. Valid values are 'regular'(default) and 'italic'.
Type: string
'fontname'
Specifies the name of the displayed font.
Type: string
'fontsize'
Specifies the size of the displayed font.
Type: scalar
'fontunits'
Determines if fontsize property is absolute or relative based on fontsize of the parent of handle. Valid values are 'pixels' (default) or 'normalized'.
Type: string
'fontweight'
Specifies the weight of the displayed font in all tabs. Valid values are 'normal'(default) and 'bold'.
Type: string
'foregroundcolor'
Specifies the foregroundcolor color. Valid values are 'transparent' or a real vector specifying RGB values in the range 0-255 or 0-1.
Type: string | vector
'iconpath'
Path to the icon of the root node.
Type: string
'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'.
Type: string
'parent'
Specifies the parent handle.
Type: scalar
'tag'
User-defined string to tag graphical control objects.
Type: string
'tooltipstring'
Tooltip to display.
Type: string
'text'
Text displayed for the root node of h.
Type: string
'userdata'
User-defined numerical data.
Type: complex | mtx | scalar
'value'
User-defined scalar data.
Type: double | integer

Outputs

h
Handle of the uitreenode created.

Example

Creates tree nodes in a hierarchical tree:

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');


Figure 1. uitree command