• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTokenField Drag and Drop
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTokenField Drag and Drop


  • Subject: Re: NSTokenField Drag and Drop
  • From: Nick Zitzmann <email@hidden>
  • Date: Mon, 29 Sep 2008 08:17:22 -0600


On Sep 28, 2008, at 6:57 PM, Chris Idou wrote:

However, when I drag a token ("Token") from the palette to the field, it
arrives as a string and not a token. tokenField:(NSTokenField *)tokenField styleForRepresentedObject:(id)representedObject gets called with a NSString and not a "Token" class. I read somewhere you need to implement -
(void)encodeWithCoder:(NSCoder *)encoder and - (id)initWithCoder: (NSCoder
*)decoder on your Token, which I did, but they don't seem to get called.



Has anyone got any tips or example code?


When I ran into this problem, I ended up solving it by subclassing NSTokenField and overriding -performDragOperation: to call - tokenField:readFromPasteboard:, which apparently the default implementation doesn't do when dragging, and from there insert the token and send out the did-change notification.

Nick Zitzmann
<http://www.chronosnet.com/>

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


References: 
 >NSTokenField Drag and Drop (From: Chris Idou <email@hidden>)

  • Prev by Date: Re: NSManagedObject custom class & for loop
  • Next by Date: Re: How to get Safari Bookmarks in the code
  • Previous by thread: NSTokenField Drag and Drop
  • Next by thread: [ann] MacCode code repository Release 1
  • Index(es):
    • Date
    • Thread