NSTokenField binding its way to a bunch o' NSManagedObjects ... ??
NSTokenField binding its way to a bunch o' NSManagedObjects ... ??
- Subject: NSTokenField binding its way to a bunch o' NSManagedObjects ... ??
- From: Richard Wolf <email@hidden>
- Date: Thu, 15 Mar 2007 21:23:22 -0500
Hi guys,
I am curious as to whether there might be some sample code that shows
how to bind an NSTokenField (ultimately) to a set of
NSManagedObjects. I "think" I have something pretty close now ...
but I'd love to learn if my ideas are anywhere near good ideas. I've
looked in the usual places for any kind of NSTokenField sample
code ... it really seems to be pretty slim pickins. :)
Basically, what I have is a simple app (just to figure this stuff
out) ... it's got an NSEntity ("Credential") with two attributes
("title" and "urn") and no relationships. I'd like my users to be
able to select one or more "Credentials" by typing in their
respective "titles" in an NSTokenField. I think the right way to do
this is to setup an NSFetchRequest in my NSTokenField delegate's
tokenField:completionsForSubstring:indexOfToken:indexOfSelectedItem:
method, fetching for 'title' LIKE(cd) %@ ... where %@ is assigned my
completionsForSubstring string. This should return an NSArray of my
managed objects to the NSTokenField. I think I should then be able
to implement the other delegate methods to return
objectForKey:@"title" to get an appropriate string on the token field
in the GUI.
Does that sound logical, or whacked out? If any of you has sample
code you would be willing to share, I'd be mighty appreciative.
Either way, thanks a ton guys!
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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