Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting the contents of an NSTokenField programatically



On May 4, 2005, at 10:51 PM, Tim Gogolin wrote:

Is there a sanctioned way to programatically set the contents of an NSTokenField (with contents that are tokens, not plain strings)? I want to preset the contents before the user sees the control, but I can't figure out a straightforward way to do it.


When you say, before the user sees the control, can you not set the value before you display the window?


--
Scott Anguish
email@hidden

That's what I'm trying to do, yes. Its just not behaving as I wish.
I am trying this in a controller instantiated in awakeFromNib, which is about as early as I can get. When I call setStringValue, the string is set AS PLAIN TEXT in the NSTokenField, when what I want to happen is for the little blue bubbles to appear. When I simply type that same string (as a user interacting with the window), then the tokens appear correctly (indicating that my tokenField:displayStringForRepresentedObject: is called and working correctly).


Apparently, setStringValue: does not trigger the same "check for tokens" logic that a user typing into the field causes. My question: How can I force the NSTokenField to look at the string contents of the entire field and "tokenize" it all?

-- Tim Gogolin
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Setting the contents of an NSTokenField programatically (From: Tim Gogolin <email@hidden>)
 >Re: Setting the contents of an NSTokenField programatically (From: Scott Anguish <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.