TreeView Browse Options: Big Size Color Default Gray Olives Green Blue Brown Red TreeView is a control of the tree structure, each node is a new class, using four values with representative each node : Text: Display text IMAGE INDEX: Show Graph Sequence SELECTED INDEX: State INDEX:
(1) Establish a directory item (the TreeView name used in this example: TVWTIPS)
Increase the node under the root directory: (node) VARCATNODE: TTREENODE; // Create a child object based on TreeView using BegintvWtips.Setfocus; // Set the focus to this TreeView control {Create a new subtitle under the root title} CATNODE: = tvwtips.items.addchild (TVWtips.Items.GetfirstNode, 'new category'); catnode.imageindex: = 1; catnode.selectedIndIndex: = 2; CATNODE.EDITTEXT; {Allow users to change this title} END;
Added the next level directory (content): varparentNode, TipNode: ttreenode; // Create TreeView using the child objects used by TreeView VersionNum: integer; begintvwtips.setfocus; // Place the focus to this TreeView control on this TreeView control....... Tag; {ver Num of new tip} ParentNode: = tvwtips.selected; {Remove the current selection node} if ParentNode.Level = Nltip dam node} parentnode: = tvwtips.selected.parent;
TipNode: = TvwTips.Items.AddChildObject (ParentNode, 'New Subject', Pointer (VersionNum)); TipNode.ImageIndex: = 3; {Normal tip bitmap} TipNode.SelectedIndex: = 4; {Highlighted tip bitmap} TipNode.MakeVisible; {Move New Tip Node Into View} TipNode.editText; {Immediately Allow User To Edit Subject} EnableTreeViewFunctions (TipNode.Level); RTFTIP.CLEAR; RTFTIP.MODIFIED: = FALSE; END;
(2) Tvwtips.Items.GetFirstNode Returns the first node of TreeView, the function type is: tTREENODE TVWTIPS.Items.count Returns all the number of nodes of the current TreeView, the integer tvwtips.selected.Level returns the currently selected node in the directory tree Level, root directory is 0 TvWtips.selected.parent Returns the currently selected node superior node, the function type is: TTREENODE