Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I drag a tree leaf?

Status
Not open for further replies.

elquixiote

Technical User
Nov 30, 2002
99
MX
I have already solved a similar problem but instead a treeview control I had list control.

Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim dy As Integer
dy = TextHeight("A")
Label5.Caption = List1.ListIndex & " " & List1.Text
Label5.Move List1.Left, List1.Top + Y + dy, List1.Width, dy
Label5.Drag
End Sub

My problem now with the treeview control is that the event nodeclick doesnt fire when the mouse down. What can I do?

El quijote ...
 
elquixiote,

I put one small treeview and one label at the relatively large form and applied this code to move node text around the form:

Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
Label1.Caption = Node.Text
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Button = vbLeftButton Then
Label1.Left = X
Label1.Top = Y
End If

End Sub

vladk
 
Thanks for your response vladk, but it's not the
functionality I'm looking for.

I tried your code and it works only if
I move the mouse over the form. It doesn't
work if the mouse moves over other controls...

I'll keep looking...

Thanks

El quijote
 
elquixiote,

Yes, I was aware of this. I did not try zorder and similar code for other controls on the form. It was just an idea.

vladk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top