Re: NSTokenField and drag 'n' drop
Re: NSTokenField and drag 'n' drop
- Subject: Re: NSTokenField and drag 'n' drop
- From: "Tom Harrington" <email@hidden>
- Date: Mon, 24 Apr 2006 14:59:55 -0600
On 4/24/06, Tom Harrington <email@hidden> wrote:
> I'm trying to implement an NSTokenField subclass with custom behavior
> when receiving a drag. Part of the requirement is that instances
> should not accept drags of arbitrary text (I only want drags from
> another NSTokenField in the window). However this is proving
> difficult, and the token fields are receiving drags and updating their
> contents when they shouldn't.
OK, it looks like the problem is that NSTokenFieldCell can accept a
drag all by itself, so dealing with drag events in an NSTokenField
subclass isn't enough.
It looks like the simplest fix is to have my NSTokenField subclass set
itself as its cell's delegate:
[[self cell] setDelegate:self];
This works since NSDraggingDestination methods are passed to the
delegate, if the delegate implements them.
I'm not sure why NSTokenFieldCell is handling drag and drop by itself,
rather than just letting NSTokenField take care of it, but this looks
like it does the trick.
--
Tom Harrington
email@hidden
AIM: atomicbird1
_______________________________________________
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