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!

Another treeview Q, please help!

Status
Not open for further replies.

jmswe

Programmer
Feb 14, 2002
31
GB
When dragging a node near the bottom border of the treeview it automatically scrolls down. But it doesent scroll up when im near the top!..

Is there some setting to make it do this?

Thanks in advance!
 
Phew! Solved it after some more digging and thinking.. :)

Add this to your dragover sub:

Private Sub TreeView2_OLEDragOver(data As Object, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single, State As Integer)
Dim nodNode As node


Set nodNode = treeview2.HitTest(X, Y)

If nodNode Is Nothing Then
Debug.Print ("Nothing")

Else


If Not nodNode.Index = treeview2.Nodes.count Then nodNode.Next.EnsureVisible
If Not nodNode.Index = 1 Then nodNode.Previous.EnsureVisible

nodNode.Selected = True
nodNode.EnsureVisible
End If

End Sub

Works like a charm :)

 
Dough!

Found out that this wont work if you are dragging a child node.. then you will get an errror..

Does anyone know of a simple and reliable way to do this??

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top