detect control key as drag and drop modifier
detect control key as drag and drop modifier
- Subject: detect control key as drag and drop modifier
- From: Benjamin Dunton <email@hidden>
- Date: Sun, 26 Jun 2005 17:13:47 -0400
All,
I am trying to detect wether or not the control key is pressed during
a drag and drop to an NSTableView. I am implementing the DnD methods
as a part of a NSArrayController subclass, ala Malcom's drag and drop
with Array controller example. I found some examples on the list of
using [[NSApp currentEvent] modifierFlags] & NSControlKeyMask, but
this does not seem to work for me...any suggestions on what I am
doing wrong? Here is my code...
The purposes is to determine whether to drop on or above, (where
control == on).
- (NSDragOperation)tableView:(NSTableView*)tv
validateDrop:(id <NSDraggingInfo>)info
proposedRow:(int)row
proposedDropOperation:(NSTableViewDropOperation)op
{
...
if([[NSApp currentEvent] modifierFlags] &
NSControlKeyMask)
{
NSLog(@"Control Modifier key detected. Drop on
\n");
[tv setDropRow:row
dropOperation:NSTableViewDropOn];
result = NSDragOperationLink;
}
else
{
// Place the drop after the last existing row
NSLog(@"No modifier. Drop above last row\n");
[tv setDropRow:[tv numberOfRows]
dropOperation:NSTableViewDropAbove];
result = NSDragOperationCopy;
}
...
}
I am always getting the case where the key is not the control key.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden