Shmulik Golan
October 17th, 2001, 04:57 AM
hi.
any one know how to select more then one item on TreeView?
Smile, Shmulik. (-;
any one know how to select more then one item on TreeView?
Smile, Shmulik. (-;
|
Click to See Complete Forum and Search --> : Multi Selection on TreeView Shmulik Golan October 17th, 2001, 04:57 AM hi. any one know how to select more then one item on TreeView? Smile, Shmulik. (-; Cimperiali October 17th, 2001, 08:54 AM 'This may simulate it. 'When you need to know which were selected, you should 'check for bacground color of each node inside a loop. 'to multiselect, hold down shift whlie left clicking on nodes option Explicit Dim itemSelected as Boolean Dim lastnodeIndex as Integer private Sub Command1_Click() Dim i as Integer With TreeView1 for i = 0 to 9 .Nodes.Add , , "a" & i, "AAA" & i next i End With End Sub private Sub TreeView1_MouseDown(Button as Integer, Shift as Integer, X as Single, Y as Single) itemSelected = false If Button = vbLeftButton then If Shift then itemSelected = true End If End If End Sub private Sub TreeView1_NodeClick(byval Node as MSComctlLib.Node) Dim i as Integer If lastnodeIndex <> 0 then TreeView1.Nodes(lastnodeIndex).BackColor = &H8000000D TreeView1.Nodes(lastnodeIndex).ForeColor = &H80000005 End If If itemSelected then Node.BackColor = &H8000000D Node.ForeColor = &H80000005 else With TreeView1 for i = 1 to .Nodes.Count .Nodes(i).BackColor = &H80000005 .Nodes(i).ForeColor = &H80000012 next i End With End If lastnodeIndex = Node.Index End Sub Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Michael and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus. The Rater Shmulik Golan October 17th, 2001, 09:20 AM Thank you very very much. Smile, Shmulik. (-; codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |