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 

Drag'n'drop + modifier keys

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



Joined: 04 Apr 2005
Posts: 69

PostPosted: Mon Apr 04, 2005 4:15 pm    Post subject: Drag'n'drop + modifier keys Reply with quote

How do I use modifier keys when doing drag and drop operations (shift, ctrl, alt)?
I'm using OnRowDrop() to do the dropping, but how do I change the dropeffect according to modifier keys? I've tried RowDropEffect(), but I can't find out how to obtain the keys from there, since GetRowDropEffectEventArgs inherits from EventArgs and not Windows.Forms.DragEventArgs.
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Mon Apr 04, 2005 11:09 pm    Post subject: Reply with quote

Override the RowDropEffect method and set the drop effect as follows:

if (Control.ModifierKeys == Keys.Control)
return DragDropEffects.Copy;
else
return DragDropEffects.Move;
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
MHB



Joined: 04 Apr 2005
Posts: 69

PostPosted: Wed Apr 06, 2005 10:06 am    Post subject: Reply with quote

Ah, thanks! I did override the RowDropEffect, but I'm new to windows forms, and didn't guess what 'Control' is - I think this is hinted to somewhere in the help pages. Perhaps a full qualification of the element would help? Ie. System.Windows.Forms.Control.ModifierKeys.

You could also make it a bit easier for users by letting the default RowDropEffect set the effect according to modifierkeys, following the standard (ctrl = copy, alt = link, shift or none = move). But that's just a userfriendly expansion option Smile
Back to top
View user's profile Send private message
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