I'm getting flaky behavior from my KVO code and I'm wondering what I'm
doing wrong. I can't find any similar examples.
I have a pop-up button and 2 NSTableViews.
The pop-up button selection controls the content of the left
NSTableView. The left NSTableView's selection controls the content of
the right NSTableView.
The pop-up button and NSTableViews are bound to separate
NSArrayControllers.
Each NSArrayController is bound to a separate NSMutableArray property
in my app controller.
My app controller observes "selectionIndex" in the pop-up button's
NSArrayController and "selectedObjects" in the left NSArrayController.
On startup, the pop-up button is populated, which causes a call to
observeValueForKeyPath:ofObject:change:context:. This sets the left
NSMutableArray, which in turn causes another (nested) call to
observeValueForKeyPath:ofObject:change:context:, which sets the right
NSMutableArray.
There seems to be a race condition -- sometimes the left table view is
populated, sometimes the right, sometimes none. Each time I edit the
nib, the behavior changes.
Is this a bogus way to implement the dependent NSTableViews?
What's the right way?
Thanks in advance,
- Stefan
_______________________________________________
Cocoa-dev mailing list ([email protected])
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/archive%40mail-archive.com
This email sent to [email protected]