View previous topic :: View next topic |
Author |
Message |
Mark Johnson Guest
|
Posted: Wed Mar 16, 2005 10:05 pm Post subject: Horizontal Scrolling in Drag and Drop? |
|
|
Is there a way to have the control scroll horizontially if your dragging to a node who's text is not visible because of being indented so far in hierarchy?
Thanks,
Mark Johnson |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Thu Mar 17, 2005 5:19 am Post subject: |
|
|
The default drag and drop behaviour does not do this - but it is easy to add yourself. Either override OnDragOver method or handle the DragOver event from VirtualTree as follows:
Code: |
private void _virtualTree_DragOver(object sender, DragEventArgs e)
{
const int scrollZone = 80;
Point p = this.PointToClient(new Point(e.X, e.Y));
if (p.X < scrollZone && _virtualTree.HorzScrollOffset > 0)
{
_virtualTree.HorzScrollOffset -= 10;
}
if (p.X > _virtualTree.Width - scrollZone)
{
_virtualTree.HorzScrollOffset += 10;
}
}
|
If you override the OnDragOver method (instead of handling the event as shown here) don't forget to call the base method or your drag and drop will no longer work.
This will give you behaviour very similar to what windows explorer gives you - where if you drag in the area near the left or right of the tree it scrolls that direction horizontally.
This should probably be default behaviour for the tree so I'll add a feature request to have this behaviour added as standard. _________________ Infralution Support
Last edited by Infralution on Tue Apr 05, 2005 9:03 am; edited 1 time in total |
|
Back to top |
|
|
Guest
|
Posted: Thu Mar 17, 2005 6:59 pm Post subject: |
|
|
Wow great response thanks!
Only issue I have is that it doesn't stop scrolling if you reverse directions.
Thanks,
Mark |
|
Back to top |
|
|
Mark Johnson Guest
|
Posted: Thu Mar 17, 2005 8:06 pm Post subject: |
|
|
I just had to tweak the scroll zone and I'm good.
Thanks again,
Mark |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Mon Mar 28, 2005 9:15 am Post subject: |
|
|
This behaviour has now been added as standard in the latest release (V1-3-3). If you wish to change the behaviour (ie change the zones etc) you can override the HorizontalDragScroll function. _________________ Infralution Support |
|
Back to top |
|
|
|