• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
detect control key as drag and drop modifier
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: NSArrayController: delay in setting selection, inserting item?
  • Next by Date: Re: NSArrayController: delay in setting selection, inserting item?
  • Previous by thread: Re: NSArrayController: delay in setting selection, inserting item?
  • Next by thread: NSMetadataQueryResultContentRelevanceAttribute?
  • Index(es):
    • Date
    • Thread