Re: Re: Drag&Drop woes...
Re: Re: Drag&Drop woes...
- Subject: Re: Re: Drag&Drop woes...
- From: <email@hidden>
- Date: Wed, 16 Mar 2005 9:15:14 +0000
Thanks for the response, Daniel. I do apologize, I should have been a little clearer in what code I had.
But first, I'm not really expecting my application to "open" any type of file; at least not in the traditional sense. All I'm really looking to do is get the full filename of the file(s) that is dropped. When dropping file or files on the app icon, the application is handed an NSArray of NSString's representing the filenames of the files. This is convenient as this is specifically what my application needs.
I have implemented the following methods, and have done so when I tried with NSTextView, the main NSWindow, and the NSTabView:
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender;
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender;
The code for the draggingEntered: method is straight out of the Apple Documentation, and the code for performDragOperation: simply grabs the NSArray from the pasteboard (NSArray *files = [pboard propertyListForType:NSFilenamesPboardType];), then calls another method, passing the array as an argument, to handle updating the controller ivars and ultimately the textviews.
I'm almost positive that the code is correct as it is copied basically directly from the Apple Documetation. I know that I also have put in NSLog() statements in the draggingEntered: method to see if even that is getting called, and it doesn't. And when I say "nothing happens" (I know that's real vague, sorry bout that), what I do is this: Start the app, switch to the Finder, open a new window and grab a couple of files (which are filetypes registered in the info.plist file) and drag them over my application window. When I release the mouse, they simply slide back into the Finder window and my app sits there as if nothing happened.
I took all the code out of my app, I'll try it again, maybe I looked over something, I don't know. If anything is different, I'll report back. But as it stands right now, I've done everything right, as far as I can tell. It just doesn't want to work for me. Strange, indeed.
Again, thanks for the reply, Daniel.
James
_______________________________________________
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