Re: Drag and drop onto a NSButton
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