• 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: Mark Williams <email@hidden>
  • Date: Sun, 26 Jun 2005 12:10:07 -0700

Thank you this is really good information.
Mark

On Jun 25, 2005, at 1:03 PM, Todd Yandell wrote:

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
References: 
 >Drag and drop onto a NSButton (From: email@hidden)
 >Re: Drag and drop onto a NSButton (From: Todd Yandell <email@hidden>)

  • Prev by Date: Re: NSArrayController: delay in setting selection, inserting item?
  • Next by Date: Re: Drag and drop onto a NSButton
  • Previous by thread: Re: Drag and drop onto a NSButton
  • Next by thread: Coredata Abstract Relations
  • Index(es):
    • Date
    • Thread