Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Horizontal Scrolling in Drag and Drop?

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support
View previous topic :: View next topic  
Author Message
Mark Johnson
Guest





PostPosted: Wed Mar 16, 2005 10:05 pm    Post subject: Horizontal Scrolling in Drag and Drop? Reply with quote

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

PostPosted: Thu Mar 17, 2005 5:19 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Guest






PostPosted: Thu Mar 17, 2005 6:59 pm    Post subject: Reply with quote

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





PostPosted: Thu Mar 17, 2005 8:06 pm    Post subject: Reply with quote

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

PostPosted: Mon Mar 28, 2005 9:15 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group