• 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: Drag and drop onto a NSButton
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drag and drop onto a NSButton


  • Subject: Re: Drag and drop onto a NSButton
  • From: Todd Yandell <email@hidden>
  • Date: Sat, 25 Jun 2005 15:03:20 -0500

Hi,

If I were you, I'd subclass NSButton and perform all of the drag and drop stuff there. It may be possible to do without subclassing, but it will save you a lot of trouble. Once you have a subclass, you need to register for some dragging pasteboard types like you've already done. Then, you just need to implement these two methods to recieve drag operations:

- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender;
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender;

The first is sent when the user drags a file over your view (but hasn't yet dropped it). The second is sent when the user actually drops the file onto your view. The second method will only be called if the first does not return NSDragOperationNone. Take a look at the documentation for "Receiving Drag Operations" for some examples. There are also several other drag and drop related methods that you can implement to get other information about dragged files.

Hope that helps!
Todd Yandell
 _______________________________________________
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

  • Follow-Ups:
    • Re: Drag and drop onto a NSButton
      • From: Mark Williams <email@hidden>
References: 
 >Drag and drop onto a NSButton (From: email@hidden)

  • Prev by Date: Services Menu? Deprecated?
  • Next by Date: Re: Implementing Safari's incomplete download behavior
  • Previous by thread: Re: Drag and drop onto a NSButton
  • Next by thread: Re: Drag and drop onto a NSButton
  • Index(es):
    • Date
    • Thread