Expanded(Element: Integer): Boolean;
Element. Tree node index.
The Expanded property determines whether a tree node hierarchy is expanded or collapsed.
Available values:
True. A tree node is expanded.
False. A tree node is collapsed.
Executing the example requires that the repository contains a dictionary containing an element hierarchy.
Locate the components DimensionTree, UiDimension, Label, two components Button named DimensionTree1, UiDimension1, Label1, Button1, Button2 respectively.
Set additional properties:
For the UiDimension component set a dictionary for the Object property.
For the DimensionTree component set the Dimension property to UiDimension1.
For the Button component named Button1 set the Text property to Expand.
For the Button component named Button2 set the Text property to Collapse.
For the Label component set the Text property to empty value.
Add links to the Dimensions, ExtCtrls, and Forms system assemblies.
The example is a handler of the OnClick event for the Button components.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Begin
DimensionTree1.Expand(13, True);
If DimensionTree1.Expanded(13) = True Then
Label1.Text := "Tree node is expanded";
End If;
End Sub Button1OnClick;
Sub Button2OnClick(Sender: Object; Args: IMouseEventArgs);
Begin
DimensionTree1.Collapse(13, True);
If DimensionTree1.Expanded(13) = False Then
Label1.Text := "Tree node is collapsed";
End If;
End Sub Button2OnClick;
After executing the example the form will contain elements of the specified dictionary to expand and collapse the tree node hierarchy with the 13 index.
Clicking the Expand button will expand the element hierarchy and the corresponding text will be displayed:
Clicking the Collapse button will collapse the element hierarchy and the corresponding text will be displayed:
See also: