• 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
Re: Keys down while dragging
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Keys down while dragging


  • Subject: Re: Keys down while dragging
  • From: "I. Savant" <email@hidden>
  • Date: Wed, 25 Oct 2006 21:24:20 -0400

On Oct 25, 2006, at 7:32 PM, PGM wrote:
http://www.cocoabuilder.com/archive/message/cocoa/2002/6/19/51217

Sorry, but it's only fair to point out that the link you provided does not really apply here.



On Oct 24, 2006, at 6:59 PM, Adam Johnson wrote:

I would like to implement a drag-and-drop where holding the Shift key
does something different than a normal drag. How can I get the state
of the modifier keys without being the active application? Any help
would be greatly appreciated.


So for example, you want (during drag) the shift key to cause a selection rectangle, rather than a move or something similar, is this what you're after?

In that case, in your mouseDown: or mouseDragged: method, you simply ask the event that gets passed to it for its keys, modifiers, or whatever you need (see NSEvent for a list of what you can get and when/how):

BOOL hasShiftKeyMask = (([theEvent modifierFlags] & NSShiftKeyMask) ! = 0);

... then use that knowledge wherever appropriate. I'll assume you know what to do with drags in general. If not, the list archives and cocoadev.com await. ;-)

--
I.S.




_______________________________________________ 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
References: 
 >Keys down while dragging (From: "Adam Johnson" <email@hidden>)
 >Re: Keys down while dragging (From: Murat Konar <email@hidden>)
 >Re: Keys down while dragging (From: Peter Schart <email@hidden>)
 >Re: Keys down while dragging (From: PGM <email@hidden>)

  • Prev by Date: Many-To-Many Predicates
  • Next by Date: Re: NSNotifications
  • Previous by thread: Re: Keys down while dragging
  • Next by thread: Re: Re: Keys down while dragging
  • Index(es):
    • Date
    • Thread