NSCollectionView and bindings to text fields in tab view
NSCollectionView and bindings to text fields in tab view
- Subject: NSCollectionView and bindings to text fields in tab view
- From: "Hank Heijink (Mailinglists)" <email@hidden>
- Date: Wed, 13 Aug 2008 11:50:23 -0600
Hi all,
I'm having some trouble figuring out a bindings problem. I've made a
litle test project that shows the problem (http://www.hankheijink.com/TestTextfieldBindings.zip
, it's a 64Kb file). This is the structure of the project:
I've got an NSCollectionView wired up so that it gets its content from
an NSArrayController. The NSArrayController is bound to an
NSMutableArray in AppController, and the array contains CollectionItem
objects. A CollectionItem object has one instance variable, value (an
NSString). Apologies for the meaningless names.
The view of the NSCollectionViewItem contains a tab view with two
tabs. Both of the tab view items contain a text field, and the value
of the text field is bound to the keypath "representedObject.value" of
the NSCollectionViewItems.
So, I should have a collection view containing views that have a tab
view with two text fields, bound to the same string value.
Here's the problem: only one of the text fields gets bound, namely the
one in the default tab. If I change the default tab to the other tab,
that one gets bound. If I make two instance variables and bind the
text fields to different ones, the same thing happens: only one of
them is bound.
Looking around on the list archives, I've found that the bindings of
NSCollectionView don't always work when set in IB. One suggestion was
setting the NSArrayController content to nil and back to the mutable
array in the AppController's awakeFromNib method, but that seems to
solve a different problem (it didn't think it would solve mine and it
didn't).
Can someone confirm that this is a bug in NSCollectionView or IB, or
am I simply doing something wrong? If the former, can someone
recommend a workaround? Should I, for instance, set the bindings
programmatically?
Oh, and in case it matters, I'm using Mac OS 10.5.4, Xcode 3.1, and IB
3.1.
Many thanks,
Hank
Hank Heijink
Columbia University
_______________________________________________
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