Scolling a TreeView

D

Dom

I want to allow drag and drop in a treeview. Of course, as you drag
too close to the bottom or top, I want the nodes to scroll so that the
user can drag to a node that is currently out of sight.

I have the basics of it done. When the user drags to a distance from
the top that is half a node height, the TreeView scrolls one way, and
as the user drags to a distance from the bottom that is half a node
height, the TreeView scrolls in the other direction. The problem
is ... sometimes there is a scroll bar at the bottom, and my
calculations force the user to drag into the scroll bar.

I could handle this if the TreeView gave me a property to indicate
that the scoll bar is visible so that I could subtract this from the
height of the treeview. But I can't find it.

Can someone give me a general approach here?
 
D

Dom

I want to allow drag and drop in a treeview.  Of course, as you drag
too close to the bottom or top, I want the nodes to scroll so that the
user can drag to a node that is currently out of sight.

I have the basics of it done.  When the user drags to a distance from
the top that is half a node height, the TreeView scrolls one way, and
as the user drags to a distance from the bottom that is half a node
height, the TreeView scrolls in the other direction.  The problem
is ... sometimes there is a scroll bar at the bottom, and my
calculations force the user to drag into the scroll bar.

I could handle this if the TreeView gave me a property to indicate
that the scoll bar is visible so that I could subtract this from the
height of the treeview.  But I can't find it.

Can someone give me a general approach here?

Just answering to put this back on the top of the queue. Come on,
guys. Someone must know the answer.
 
J

Jeff Gaines

Just answering to put this back on the top of the queue. Come on,
guys. Someone must know the answer.

There is no top of the queue, your reply just gets tagged on to you
original post.

How about starting the scroll earlier, say about 4 or 5 nodes from the top
or the bottom?
 
D

Dom

There is no top of the queue, your reply just gets tagged on to you
original post.

How about starting the scroll earlier, say about 4 or 5 nodes from the top
or the bottom?

Google groups puts all the posts in a queue. The problem with your
suggestion is that if the user wants to drop it off in, say, the third
node from the top, then the Tree scrolls and he misses it. It's
disorienting, and it isn't the way it is done in MS file lists, as in
a Open Box. There must be some property I'm missing.
 
K

kndg

I want to allow drag and drop in a treeview. Of course, as you drag
too close to the bottom or top, I want the nodes to scroll so that the
user can drag to a node that is currently out of sight.

I have the basics of it done. When the user drags to a distance from
the top that is half a node height, the TreeView scrolls one way, and
as the user drags to a distance from the bottom that is half a node
height, the TreeView scrolls in the other direction. The problem
is ... sometimes there is a scroll bar at the bottom, and my
calculations force the user to drag into the scroll bar.

I could handle this if the TreeView gave me a property to indicate
that the scoll bar is visible so that I could subtract this from the
height of the treeview. But I can't find it.

Can someone give me a general approach here?

Hi Dom,

I'm not sure if this help but...

Instead of using Height and Width property, personally I would use
ClientSize property instead. This property usually will give the correct
width and height. Check if this solve your need.

Regards.
 
D

Dom

Hi Dom,

I'm not sure if this help but...

Instead of using Height and Width property, personally I would use
ClientSize property instead. This property usually will give the correct
width and height. Check if this solve your need.

Regards.- Hide quoted text -

- Show quoted text -

Ding, Ding, Ding. We got a winner! Thanks so much, Kndg.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top