Solved

Scrolling Access Treeview

Posted on 2006-07-08
9
668 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

Author Comment

by:dwood1112
ID: 17065943
Thanks I tried the suggestion (several ways) but I couldn't get it to work.
0
 
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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
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…

696 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