Hello,
I'm new to Cocoa programming. I would like to be able to drag filenames from
Finder to a custom view in my application. Both previous mails and Mr. Google
redirect to Drag and Drop Programming Topics for Cocoa
(http://developer.apple.com/documentation/Cocoa/Conceptual/DragandDrop/) . I've
read this, but something still doesn't work.
Declaration of my custom view (a subclass of NSView) looks like:
@interface myView : NSView {
}
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender;
- (void)draggingExited:(id <NSDraggingInfo>)sender;
- (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender;
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender;
- (void)concludeDragOperation:(id <NSDraggingInfo>)sender;
@end
then I have a dummy implementation that does nothing but writes to debugging
console :
@implementation myView
- (id)init {
[super init];
[self registerForDraggedTypes: [NSArray arrayWithObject:
NSFilenamesPboardType]];
return self;
}
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender {
NSLog(@"draggingEntered:");
return NSDragOperationCopy;
}
- (void)draggingExited:(id <NSDraggingInfo>)sender {
NSLog(@"draggingExited:");
}
- (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender {
return YES;
}
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender {
NSLog(@"draggingOperation");
return YES;
}
- (void)concludeDragOperation:(id <NSDraggingInfo>)sender {
NSLog(@"draggingFinished:");
}
In my AppController class (main class in app) I create new myView object and in
Interface Builder this object is connected with a Custom View layout. But when
I run my app and try anything from Finder the console remains silent. Can
anyone tell me what I'm missing?
Thanks,
Marcin _______________________________________________
Cocoa-dev mailing list ([email protected])
Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]