Re: DragDropImageView
Re: DragDropImageView
- Subject: Re: DragDropImageView
- From: "Alastair J.Houghton" <email@hidden>
- Date: Tue, 9 Sep 2003 09:13:50 +0100
On Monday, September 8, 2003, at 11:11 pm, Lorenzo wrote:
If I drag an NSImage from the NSImageView onto a TextEdit document
or onto an Entourage HTML email, everything works fine.
But if I drag the *same* image to the Finder, the Finder freezes.
And if I drag the *same* image onto a Photoshop document, my
application
quits unexpectedly. May you please explain me why? Here's the code.
If your application quits unexpectedly, you should really try to use
the debugger to find-out why; it is very probably related to the
problem you're having with the Finder, and without seeing *all* the
code for your application, people on the list are unlikely to find it.
Looking at the code you posted, I think the problem is probably that
you are receiving a type that you don't understand and are not putting
an object into the pasteboard. Make sure that you send appropriate
-declareTypes:owner: and -addTypes:owner: messages; in particular, make
sure that you aren't declaring more data types than your function
supports.
I would remove the line you added, by the way, because I don't think
you should be trying to put "nil" into the pasteboard.
Try adding some NSLog() lines to your code so that you can see what
type you are being asked for. In particular, try doing
NSLog("Asked for: %@\nPasteboard types:\n%@\n", type, [sender types]);
and see how many things (and which things) are in the types array.
Also, I don't understand why, when quit, the routine above is being
called
hundreds of times. It should be called once only (just to let the user
copy,
quit and paste to other applications). No?
It will typically be called more than once in order to retrieve all the
types of data supported by the application. Otherwise a user might
copy an object, quit your application and then be unable to access an
appropriate representation on the pasteboard.
Kind regards,
Alastair.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.