Re: drag and drop problem.
Re: drag and drop problem.
- Subject: Re: drag and drop problem.
- From: stoyan panov <email@hidden>
- Date: Thu, 17 May 2007 14:56:28 +0300 (EEST)
No , I implement only NSDraggingDestination protocol. I want to drag image or other file to the app. Do I need to implement NSDragging source ? I thought implementing NSDraggingDestination protocol is sufficent, but obviously it isn't.
-------------------------------------
On 5/16/07, Clint Shryock <email@hidden> wrote:
are you implementing draggingSourceOperationMaskForLocal:?
it must be implemented by the source object
http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Protocols/NSDraggingSource_Protocol/Reference/Reference.html#//apple_ref/occ/instm/NSObject/draggingSourceOperationMaskForLocal:
+Clint
>DropView.h
>
>@interface DropView : NSView
>{
>
>}
>
>@end
>
>
>DropView.mm
>
>#import "DropView.h"
>
>
>@implementation DropView
>
>- (id)initWithFrame:(NSRect)frameRect
>{
> if(self = [super initWithFrame:frameRect])
> [self registerForDraggedTypes:[NSImage imagePasteboardTypes]];
> return self;
>}
>
>//Destination Operations
>- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
>{
> NSLog(@"entered");
> return NSDragOperationCopy;
>}
>
>- (void)draggingExited:(id <NSDraggingInfo>)sender
>{
> NSLog(@"exited");
> [self setNeedsDisplay: YES];
>}
>
>- (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender
>{
> NSLog(@"prepare");
> return YES;
>}
>- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
>{
> NSLog(@"perform");
> return YES;
>}
>
>- (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender
>{
> NSLog(@"updated");
> return NSDragOperationCopy;
>}
>
>- (void)concludeDragOperation:(id <NSDraggingInfo>)sender
>{
>NSLog(@"conclude");
>}
>
>
>- (BOOL)acceptsFirstMouse:(NSEvent *)event
>{
> return YES;
>}
>
>@end
>
>But if it DrowView class inherits NSImageView , everything is ok.
>
> >post some code.
> >
> >On 5/14/07, stoyan panov <email@hidden> wrote:
> >>
> >>
> >> Yes I did. It's still not working.
> >>
> >> Stoyan.
> >>
> >>
> >>
> >> >
> >> >Did you registerForDraggedTypes: on the NSView?
> >> >_______________________________________________
>
> >> >On May 11, 2007, at 5:46 AM, stoyan panov wrote:
> >> >
> >> >> Hi , i am newcommer to cocoa. I have the following problem: I make
> >> >> custom view , and imlement the drop protocol, but i still can
> >> >> recive dragginEntered or other message. Where may be the problem.
>
>Cocoa-dev mailing list (email@hidden)
>
>Do not post admin requests or moderator comments to the list.
>Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
>Help/Unsubscribe/Update your Subscription:
>
>This email sent to email@hidden
>
-----------------------------------------------------------------
Нека музиката бъде с теб!
http://musicidol.btv.bg/
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden