?
Solved

Scrolling Access Treeview

Posted on 2006-07-08
9
Medium Priority
?
673 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 1000 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:dwood1112
ID: 17065943
Thanks I tried the suggestion (several ways) but I couldn't get it to work.
0
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 1000 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 85
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

765 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