Add(Node: IWebTreeNode; Text: String; Mode: WebInsertMode): IWebTreeNode;
Node. The node, at which a new node is created.
Text. Node text.
Mode. Node insert mode.
The Add method creates a new tree node with specified text.
The Node parameter is mandatory. A new node is added on the same level with the Node node.
Executing the example requires that the repository contains a web form and the TreeCombo component named TreeCombo1 on the form. The specified procedure is set as a handler of the OnShow event for the web form.
Sub TESTWebFormOnShow;
Var
Nodes: IWebTreeNodes;
Node: IWebTreeNode;
Begin
Nodes := TreeCombo1.Nodes;
Nodes.Clear;
Node := Nodes.AddToRoot("Root");
Nodes.AddChild(Node, "First");
Nodes.AddChild(Node, "Two");
Nodes.Add(Nodes.FirstNode, "---", WebInsertMode.InsertBefore);
Nodes.FirstNode.Selected := True;
End Sub TESTWebFormOnShow;
When the web form is started, a list of elements is created and the first element is selected in the TreeCombo1 component.
See also: