|
-
August 4th, 2001, 08:17 PM
#1
Determine Treeview Node
How can I determine a node, from x y co-ordinates of the treeview control. Actually, I am making a program, which drags and Item from a list box to tree view control. It drops the text data on to the tree view control to add nodes to It. How can I specify, on which node, the user has dropped the item??
Thanx for help in Advance.
Good Bye .. Developers
Waqas...
-
August 5th, 2001, 01:13 PM
#2
Re: Determine Treeview Node
I believe you want to use the .Hittest method. Refer to MSDN Help for a example using a Treeview
This simple example will display the node upon which something is dropped
private Sub TV_DragDrop(Source as Control, x as Single, y as Single)
Debug.print TV.HitTest(x, y)
End Sub
John G
-
August 5th, 2001, 11:02 PM
#3
Re: Determine Treeview Node
There is a treeview and textbox on the form, set the textbox OLEDragMode=Automatic
set the treeview OLEDropMode=ccOLEDropManual. Run the project, input any text in the textbox
select the characters in the textbox, drag&drop it on the root node of treeview.
Here is the code.
private Sub Form_Load()
TreeView1.Nodes.Add , , , "root"
End Sub
private Sub TreeView1_OLEDragDrop(Data as MSComctlLib.DataObject, Effect as Long, Button as Integer, Shift as Integer, x as Single, y as Single)
Dim tvwNode as Node
set tvwNode = TreeView1.HitTest(x, y)
Call TreeView1.Nodes.Add(tvwNode, tvwChild, , Data.GetData(1))
End Sub
//-----------------------------------------\\
Where there's a wire , there's a way
\\-----------------------------------------//
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|