Thank you, Ken. It sounds like you're saying that everything may
technically be getting linked up so that it would work, except I must be
switching the array out in a non-KVO-compliant manner, so bound objects
don't get notified of the change. Your reply gives me some ideas for
experimentation. :-)
On 2010-01-20 14:15, Ken Thomases wrote:
For your original question, I think the issue is how "it" gets handed the list of games and how
"it" makes the array available with -gameList. (As you can guess, I'm not sure what "it"
refers to in your explanation.)
The bindings are re-established from the NIB during NIB loading. If you change
the gameList property of the object which is serving as the NIB's owner in a
non-KVO-compliant manner after that point, then the binding for the array
controller's content won't follow the update.
I'm not sure if -setContent: on the array controller works. In fact, I doubt
it does. If we use the Content Object binding of an array controller as a
guide, then the content object has to be another array controller. It makes
sense to bind the array controller's Content Array binding to the gameList
property of File's Owner, as you have done. It's just that you have to make
sure you're only mutating that property in a KVO-compliant manner.
Regards,
Ken
On Jan 20, 2010, at 12:01 PM, Charles Jenkins wrote:
Okay, let me rephrase my question...
If I get a pointer to the NSArrayController and then call [myArrayController
setContent:gameList], then should the array controller "just work"?
In other words, if the game descriptions do not appear in my NSPopUp, then the
problem just about has to be in the binding of the NSPopUp to the array
controller, right?
On 2010-01-17 15:17, Charles Jenkins wrote:
I am struggling with bindings. I have worked through the examples in the
Hillegass book, but it seems that none of the examples using NSPopUp quite
matches what I need.
In my app, just before a view appears, it gets handed a list of games in an
NSMutableArray. It makes the array available with -(NSMutableArray*)gameList. I
want the NSPopUp to contain a list showing the value of -(NSString*)description
for each item in the list.
I thought I was supposed to do this by adding an NSArrayController to my .nib
file, and then making the following bindings:
Array Controller's Content Array = File's Owner.gameList
NSPopUp's Content = Array Controller.arrangedObjects
At runtime I get a totally empty popup. I can imagine two possibilities for why
it doesn't work:
a) I've got the bindings wrong
b) The array controller can't handle the fact that the gameList pointer changes
right before the view gets shown
Can anyone help me get this working?
-------------------------------
Just in case it helps pre-answer any questions you may have, here are minimal
descriptions of my classes:
@interface GameScores {
}
-(NSString*)description;
@end
@interface GameViewController {
NSMutableArray* gameList;
}
@property (retain) NSMutableArray* gameList;
@end
In the .nib file, NSArrayController tries to manage File's Owner.gameList, and
the NSPopUp is supposed to display the NSArrayControler's arrangedObjects.
_______________________________________________
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/cjenkins%40tec-usa.com
This email sent [email protected]
_______________________________________________
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/ken%40codeweavers.com
This email sent [email protected]
_______________________________________________
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]