TreeView's use

zhaozj2021-02-08  216

TreeView is a control of the tree structure. Each node is a new class. It has four values ​​with representative each node: Text: Display text IMAGE INDEX: Show graphics selected index: State Index: (1 Establishing a directory entry (TreeView name used in this example) Adds nodes under the root directory: (Node) VarcatNode: TTREENODE; // Building a TreeView Sub-object BegintvWtips.Setfocus; // Place the focus This TreeView control is {created a new subtitle under the root title} catnode: = tvwtips.Items.addchild (TVWtips.Items.GetfirstNode, 'new category'); catnode.ImageIndex: = 1; catnode.selectedIndex: = 2 CATNODE.EDITTEXT; {Allow users to change this title} end; add the next level directory (content): varparentNode, TipNode: TTREENODE; // Create TreeView Used Subjects VersionNum: Integer; begintvwtips.setfocus; // Focus Set to this TreeView control on VersionNum: = tMenuitem (sender) .tag; {ver Num of new tip} ParentNode: = tvwtips.selected; {Remove the current selection node} if ParentNode.Level = nltip the {Parent Cannot Be a TIP 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) a description of the node TvwTips.Items.GetFirstNode return TREEVIEW The function type is: tTREENODE TVWTIPS.ITEMS.COUNT Returns the number of all nodes of the current TreeView, the integer TVWtips.selected.Level returns the level of the currently selected node, the root directory is 0 TVWTIPS.Selected.Parent Return to the current node level Node, function type is: TTREENODE

转载请注明原文地址:https://www.9cbs.com/read-2809.html

New Post(0)