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: cocoa bindings NSTableColumn to @allKeys?




On Dec 30, 2007, at 9:16 AM, Keary Suska wrote:

You want to bind the value to an array controller that is bound using the
above options.


This is probably insufficient, since you then need to know what key to use in the table column binding (and @allKeys won't work as a keypath).


On Dec 29, 2007, at 11:00 PM, Michael Hanna wrote:
I have a model object YKKFlickrUser which aggregates an
NSMutableDictionary called m_photoLists which contains keys for
another model object, YKKPhotoList(I have accessors -photoLists and
-setPhotoLists).
[...]
bind > Flickr Users,

controller key > "selection",
model key path > "photoLists.@allKeys"

Is each key simply a string (as would seem to be the case from the spec)? And do you intend the keys to be editable?

If both are true, then using an array controller to manage them won't work, since the bindings architecture expects to deal with objects that themselves have keys and values and an array controller. If you can get the actual dictionary (from which allKeys is derived) then on Leopard you can use the NSDictionaryController (bind its content dictionary to [Flickr Users].selection.photoLists.theDictionary).


If each key is simply a string and you just want to display them, then you can use an additional array controller, but you need to "fudge" a key for the table column binding.


You bind the array controller's contentArray to [Flickr Users].selection.photoLists.allKeys

You can then bind the table column to:
[AllKeysArrayController].arrangedObjects.self
or
[AllKeysArrayController].arrangedObjects.description


mmalc

_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: cocoa bindings NSTableColumn to @allKeys? (From: Keary Suska <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.