Solved

Scrolling Access Treeview

Posted on 2006-07-08
9
665 Views
Last Modified: 2012-06-27
I'm using the Northwind code on my projects Treeview and it is working well....But I cant scroll if the item is above or below the visible boundry...I've searched the comments and it looks like .EnsureVisible on DragOver is the way to go, but I'm not having much success...

I'm using the following code:

Private Sub xTree_OLEDragOver(Data As Object, Effect As Long, _
        Button As Integer, Shift As Integer, x As Single, y As Single, _
        State As Integer)
    Dim oTree As TreeView

    'Create a reference to the TreeView control.
    Set oTree = Me!xTree.Object
   
    'If no node is selected, select the first node you dragged over.
   
       If oTree.SelectedItem Is Nothing Then
        Set oTree.SelectedItem = oTree.HitTest(x, y)
    End If

    'Highlight the node being dragged over as a potential drop target.
    Set oTree.DropHighlight = oTree.HitTest(x, y)
End Sub

Can anyone help me figure out how to wrap .EnsureVisible into this??

Lost in the forest
0
Comment
Question by:dwood1112
  • 5
  • 2
  • 2
9 Comments
 
LVL 11

Expert Comment

by:BillPowell
ID: 17065504
Check your property sheet and see if the Scroll property is set to yes.
0
 

Author Comment

by:dwood1112
ID: 17065545
The scroll property is set to yes....As far as I can tell, this just adds a scroll bar...not much use during D&D
0
 
LVL 11

Assisted Solution

by:BillPowell
BillPowell earned 250 total points
ID: 17065597
Im not sure but you could try something like this: (completely untested)

Dim nodCurrent As Node
Set nodCurrent = oTree.SelectedItem
nodCurrent.EnsureVisible = True

Hopefully someone more versed in this drag and drop with Treeview will ring in.
0
 

Author Comment

by:dwood1112
ID: 17065943
Thanks I tried the suggestion (several ways) but I couldn't get it to work.
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 250 total points
ID: 17066151
Did you try the HitTest for your .EnsureVisible:

Set oTree.SelectedItem = oTree.HitTest(x, y)

Otherwise, I don't know how you can do this ... the builtin MS treeview is pretty limiting in many regards.
0
 

Author Comment

by:dwood1112
ID: 17066331
Thanks...I'll give it a try
0
 

Author Comment

by:dwood1112
ID: 17068928
OK....I finally got it to work with the code below...at least it scrolls down...still working on getting it to scroll back up. Thanks for your help


 Dim oTree As TreeView
 Dim currentNode As Node
       
 Set oTree = Me!xTree.Object
 Set DropHighlight to the mouse's coordinates.
 Set oTree.DropHighlight = currentNode
 Set currentNode = oTree.HitTest(x, y)
 currentNode.EnsureVisible
0
 
LVL 84
ID: 17068940
Good to know ... keep us posted as to your progress, this is something I'd like to include in my sample.
0
 

Author Comment

by:dwood1112
ID: 17068960
Revision:

The SetDropHighlight isn't needed. the code below works fine for downward scroll....

 Dim oTree As TreeView
 Dim currentNode As Node
       
 Set oTree = Me!xTree.Object
 Set currentNode = oTree.HitTest(x, y)
 currentNode.EnsureVisible
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now