Skip navigation.
 
mlHow to bind two combo boxes with Cocoa Bindings ?
FROM : Eric Morand
DATE : Sun Nov 28 15:55:58 2004

I'm trying to do something that is very commonly used and should be
very easy to do. I just can't figure how to do it.

Here it is : I've two combo boxes.

The first one uses a data array that is fixed.
The second one must dynamically change its content when the first combo
box selection is modified.

I just can't figure how Cocoa Bindings can allow me to do this ! I've
been obviously able to have the first combo box works perfectly. But
the second one remains empty, whatever binding I try.


The array (named categoriesArray) that is bound to the first combo box
contains objects (instances of class Category) that have a method that
returns an array ( - (NSArray *)subCategories; ) of arranged objects.

For instance, for the category "car", [car subCategories] returns the
array : "fuel, repair, parking".

I've defined two NSArrayController in PB :

- Categories Controller :

Bind to : MyController
Controller Key : selection
Model Key Path : categoriesArray

- SubCategories Controller :

Bind to : Categories Controller
Controller key : selection
Model Key Path : subCategories

If  i understand well, the second controller call subCategories for the
object selected on the first controller. Right ? Or am I plain wrong ?



It seems I'm wrong since the subCategories method is never called,
whatever I select in the first combo box.



Can someone help on this ?



Thanks !


Eric.

Related mailsAuthorDate
mlHow to bind two combo boxes with Cocoa Bindings ? Eric Morand Nov 28, 15:55
mlRe: How to bind two combo boxes with Cocoa Bindings ? Joakim Danielson Nov 28, 16:49
mlRe: How to bind two combo boxes with Cocoa Bindings ? Bruce Toback Nov 29, 02:45
mlRe: How to bind two combo boxes with Cocoa Bindings ? mmalcolm crawford Nov 29, 04:10