HI There
While attempting to drag a node item within a treeview, the "Hittest()" method always returns the
first node of the treeview, thus I'm not able to drop the selected node into any node other
than the first node i.e. the node is always dropped onto the first node only.
Can someone throw somelight on the above problem
Any Suggestions in this regard will be highly appreciated.
Best Regards
Shaheer Shamsi
The code for the said program is as follows:
User defined Form Properties : nodx,indrag
The activex component used is oletreeviewcontrol 6.0
Property set for this control are:
oledragmode 1 (automatic drag)
oledropmode 1 (manual drop)
Thisform.INIT()
tvwchild = 4
=Thisform.TreeView1.Nodes.Add(, , , "Parent1", 0)
=Thisform.treeview1.Nodes.Add(, , , "Parent2", 0)
=Thisform.treeview1.Nodes.Add(1, tvwChild, , "Child 1", 0)
=Thisform.treeview1.Nodes.Add(1, tvwChild, , "Child 2", 0)
=Thisform.treeview1.Nodes.Add(2, tvwChild, , "Child 3", 0)
=Thisform.treeview1.Nodes.Add(2, tvwChild, , "Child 4", 0)
=Thisform.treeview1.Nodes.Add(3, tvwChild, , "Child 5", 0)
Thisform.treeview1.Nodes.Item(1).expanded = .t.
Thisform.treeview1.Nodes.Item(2).expanded = .t.
THISFORM.Treeview1.Mousedown()
LPARAMETERS button, shift, x, y
ThisForm.nodX = This.SelectedItem
THISFORM.Treeview1.MouseMove()
LPARAMETERS button, shift, x, y
If Button = 1 && Signal a Drag operation.
ThisForm.indrag = .T.
This.OleStartDrag
EndIf
THISFORM.Treeview1.OleDragDrop()
LPARAMETERS data, effect, button, shift, x, y
If This.DropHighlight =.null.
Thisform.indrag = .F.
Else
If !ThisForm.nodX = This.DropHighlight
Clea
? ThisForm.nodX.Text + " dropped on " + This.DropHighlight.Text
This.DropHighlight = .Null.
ThisForm.indrag = .F.
ENDIF
EndIf
THISFORM.Treeview1.OleDragOver()
LPARAMETERS data, effect, button, shift, x, y, state
If ThisForm.indrag = .T.
This.DropHighlight = This.HitTest(x, y) && The problem area
EndIf
Have fun & enjoy !!!......