This is a controversial control; I have tried to understand the criticism and understand the author. In short, to the author's ideas close to it, or good.
TiwtreeviewUnit and succession chain:
Iwcomptreeview.tiwtreeview < Tiwcustomcontrol < Tiwbasehtmlcontrol < Tiwbasecontrol < Tiwvclbasecontrol < Tcontrol < Tcomponent < Tpersistent < TObject
Main members:
Property Items:tiwtreeviewitems//The collection of all Item property Selected:tiwtreeviewitem//Here, called "Current Item" more suitable property autoi Ndent:boolean//whether automatic indentation; Default Trueproperty Doserversideplusminus:boolean//If True, the Html does not contain the collapsed part, which needs to be expanded and then read from the server; Instead, the Html contains all the nodes; Default Falseproperty treeviewimages:tiwtreeviewimages//Through its openfolderimage, Closedfolderimage, DocumentImage, PlusImage, Minusimage Sub-attribute specifies five icons property itemspace:tiwtreeviewitemspace//adjust vertical, Horizontal spacing properties Useitemimages:boolean//whether to use Item Logo Image Property Treeviewimageswidth:integer//Icon Width property Treeviewimagesheigth:integer//Icon Height property Useframe:bool EAN//Whether to use Frame property scrolltoname:string//Scroll to ItemProperty of the specified name Scrollbars:tiwscrollstyle Scroll bar Options Property Wrapitems:boolean//item text can be wrapped; Default Falseproperty Dorefreshcontrol:boolean//Must be True to modify certain properties Treeitemclick:tiwtreeviewclickevent// It allows you to specify the Click event property for each Item ONPLUSMINUS:TTREEVIEWPLUSMInusproc//procedure CLEARALL//Whenever a child node is expanded or collapsed
TiwtreeviewitemsAnd
Tiwtreeviewitem:
{Iwcomptreeview.tiwtreeviewitems < Townedcollection < TCollection < Tpersistent < Tobject}property Count: Integerproperty Items[aindex:integer]: tiwtreeviewitemfunction Add (Aparentitem:tiwtreeviewitem): Tiwtreeviewitemprocedure clearprocedure Delete (index:integer) function Insert (Index:integer): tcollectionitem{ Iwcomptreeview.tiwtreeviewitem < Tcollectionitem < Tpersistent < Tobject}property ParentItem: Tiwtreeviewitemproperty subitems:tlistproperty userdata:tobjectproperty caption:stringproperty Expanded: Booleanproperty font:tiwfontproperty hint:stringproperty Itemimages:tiwtreeviewimagesproperty tag:integerproperty Url:stringproperty version:integerproperty css:stringproperty Collection:tcollectionproperty id:integerproperty Index:integerproperty name:stringproperty displayname:stringproperty onclick:tnotifyeventprocedure DoClickfunction Haschild:boolean
Test:
{IWRegion1 and IWTreeView1 are placed on blank forms, and the following code is more convenient to implement at design time}procedure tiwform1.iwappformcreate (sender:tobject); var Fitem: Tiwtreeviewitem;begin iwregion1.width: = 200; Iwregion1.align: = Alleft; Iwregion1.color: = Clwebyellow; LinkColor: = clwebred; If the OnClick event is specified for Tiwtreeviewitem, it will be rendered as a link iwtreeview1.parent: = IWRegion1; Iwtreeview1.align: = alclient; IWTREEVIEW1.ITEMS.ADD (nil). Caption: = ' ItemA '; IWTREEVIEW1.ITEMS.ADD (nil). Caption: = ' itemb '; IWTREEVIEW1.ITEMS.ADD (nil). Caption: = ' ITEMC '; Fitem: = IWTreeView1.Items.Add (nil); Fitem.caption: = ' itemd '; IWTREEVIEW1.ITEMS.ADD (Fitem). Caption: = ' ItemD1 '; IWTREEVIEW1.ITEMS.ADD (Fitem). Caption: = ' ItemD2 '; Fitem: = IWTreeView1.Items.Add (Fitem); Fitem.caption: = ' ItemD3 '; IWTREEVIEW1.ITEMS.ADD (Fitem). Caption: = ' ItemD31 '; IWTREEVIEW1.ITEMS.ADD (Fitem). Caption: = ' ItemD32 '; end; {Although you can specify the OnClick for each Item, I think it is more convenient to specify with the Treeitemclick event, which can be distinguished by its Tag, ID, Name, caption, and so on}procedure Tiwform1.iwtreeview1treeitemclick (Sender: TObject; Atreeviewitem:tiwtreeviewitem); Begin if not Atreeviewitem.haschild then Webapplication.showmessage ( atreeviewitem.caption); end;
: