Re: Binding NSTabViews in NSCollectionViews?
Re: Binding NSTabViews in NSCollectionViews?
- Subject: Re: Binding NSTabViews in NSCollectionViews?
- From: David Carlisle <email@hidden>
- Date: Mon, 3 Dec 2007 14:47:40 -0700
I can see that your simple demo example fails to perform as expected.
One thing that confused me initially is that "MyController" isn't a
controller, but just an NSObject that contains the array of NSNumbers.
You mention the simpler case of dropping a single NSTabView on the
window directly, which works as expected. It would be interesting to
know if you are then binding that NSTabView to a single NSNumber in
MyController, similar to the way you are binding the first case. If
the simpler case works, it would then be interesting to subclass
NSNumber to increment its value by 10 every time its value is
accessed, so you can tell if the NSTabView causes the NSTextField to
update its value each time the tab is clicked and the field becomes
visible.
If it does update each time, then it would appear that in the original
NSCollectionView case the NSTextFields that were not initially visible
were not bound in a way that would allow them to update their value
when the NSTabView was changed.
If it does not update each time, then it would appear that NSTabView
was programmed to assume its subfields did not need updating when they
become visible, while NSCollectionView was programmed to assume that
only the visible fields needed initial values.
That's just my guess as to what I think is happening.
On Nov 29, 2007, at 10:08 PM, Joshua Emmons wrote:
I have the following very simple setup (project can be found at http://www.skia.net/media/tabbinding.zip)
:
o MyController has but one ivar: NSArray *myNumbers
o myNumbers is assigned an array of NSNumbers (0,1,2,0,1,2...) in -
wakeFromNib
o The app's nib instantiates MyController
o The app's window is completely filled with an NSCollectionView
whose content property is bound to MyController.myNumbers
o NSCollectionView's NSCollectionViewItem's "view" outlet is
connected to an NSTabView
o The NSTabView has three tabs. Its SelectedIndex property is bound
to the representedObject of the NSCollectionViewItem
o Finally, each tab has a label in it. This label's value property
is ALSO bound to the representedObject of the NSCollectionViewItem.
Here's what it looks like when run: http://www.skia.net/media/tabbinding.png
Note that NSTabView's binding of SelectedIndex works just fine.
First the 0 index tab is selected, then the 1, then the 2, etc. etc.
The trouble is the label.
Each tab should display the index number it is bound to in its
label. In the picture above, only the first tab (index 0) is
actually able to find the value it's bound to. The reason? That's
the tab selected in IB!! If I select the second tab (index 1) in IB,
I get the following:
http://www.skia.net/media/tabbinding2.png
For some reason, bindings of controls in the initial tab (the one
selected in IB) work fine, but all the rest are dead. This only
happens within an NSCollectionView. If drop my NSTabView on the
window directly, all the bindings in all the tabs work.
Anybody know what NSCollectionView is doing with its
NSCollectionViewItem behind the scenes that messes tab views up? I'm
dumbfounded!
Many thanks,
-Joshua Emmons
_______________________________________________
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
_______________________________________________
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