Re: Drag and drop to an NSTextView
Re: Drag and drop to an NSTextView
- Subject: Re: Drag and drop to an NSTextView
- From: Matt Neuburg <email@hidden>
- Date: Wed, 16 Aug 2006 10:33:09 -0700
- Thread-topic: Drag and drop to an NSTextView
On Wed, 16 Aug 2006 08:27:34 +0100, Simon Whitaker <email@hidden> said:
>I have an NSTextField in my app, which I (naively?) assumed I would
>simply be able to drag and drop text clippings to "for free". This
>doesn't appear to be the case. I wondered if anyone has a link to a
>good primer on using simple drag and drop? Or more specifically, I'm
>not sure what I need to put in my array arg to
>registerForDraggedTypes in order to register for text clippings - any
>pointers there would be appreciated.
Interfering with an NSTextField's drag and drop behaviour is quite tricky
because there are actually two controls to deal with - the NSTextField,
which is active when the user is not editing, and the field editor (an
NSTextView), which is active when the user *is* editing. So the first thing
to do is think again (and experiment again), as you will find that when the
focus is already on the NSTextField (meaning it is being edited and the
field editor is sitting in front of it), you DO get drag and drop text
clippings "for free".
Now that we've got that little misconception out of the way, we can talk
about implementing drag and drop. The "good primer" you are looking for is
the online manual, which is excellent on this topic and is on your hard
disk. To learn what a text clipping is when dragged, use PasteboardPeeker:
<http://developer.apple.com/samplecode/PasteboardPeeker/>
m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
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