PDA

View Full Version : NSArrayController Weirdness




Sbrocket
Mar 10, 2008, 11:13 AM
Hey there Cocoa gurus. I've recently started picking up Obj-C/Cocoa after telling myself I'd get around to it for a few years, and I'm running into some weirdness with bindings.

I've gone through the great tutorial on bindings at cocoadevcentral (http://cocoadevcentral.com/articles/000080.php) and I got it to work perfectly, just as expected. However, when I try to apply the same principles to my own in-progress app the results are less than satisfactory.

Ok...here's the situation as best I can explain it...
I have an NSPopUpButton bound to an NSArrayController ("ConvertTypes") which controls an array of a self-defined class called "Type." This part works fine, although there is no updating of values involved with this pop-up.

I then have two more NSPopUpButtons, each bound to an NSArrayController ("ConvertUnits1" and "ConvertUnits2"), which are each in turn bound to the selection of original ConvertTypes controller and control an array that is property of that Type class. (Hope this isn't too confusing yet...) The problem is this - if I change the selected value on the first pop-up menu, the 2nd and 3rd menus should update with the new values (they're units) specific to the selected value (a unit type) in the first pop-up. But they don't. :mad:

If anyone could take a look, I'd be greatly appreciative...cause I'm stumped.
http://dl.getdropbox.com/u/417/Converter.zip



kainjow
Mar 10, 2008, 11:59 AM
Take a look at my post here (http://forums.macrumors.com/showpost.php?p=4837770&postcount=7). Bindings with popup buttons take slightly more work.

Sbrocket
Mar 10, 2008, 12:05 PM
Yeah, I just noticed the selection that wasn't changing. I'll take a look, thanks.

Edit:
Aha, thats the ticket. Thanks for the reply.