• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to bind two combo boxes with Cocoa Bindings ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to bind two combo boxes with Cocoa Bindings ?


  • Subject: Re: How to bind two combo boxes with Cocoa Bindings ?
  • From: Joakim Danielson <email@hidden>
  • Date: Sun, 28 Nov 2004 16:49:57 +0100

Combo boxes contains values (NSString or NSNumber) not objects, so your actually binding your SubCategories to the string you use to display your Category and not the object itself.

You might find a solution to this in the archives, http://www.cocoabuilder.com, otherwise I would recommend that you use pop-up buttons instead.

Joakim


On 2004-11-28, at 15.55, Eric Morand wrote:

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.

_______________________________________________
MacOSX-dev mailing list
email@hidden
http://www.omnigroup.com/mailman/listinfo/macosx-dev


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Prev by Date: Re: Crash after an NSNotification is posted
  • Next by Date: Re: Nib files and outlets
  • Previous by thread: Re: Crash after an NSNotification is posted
  • Next by thread: Encoding a pointer to an object, not the object itself
  • Index(es):
    • Date
    • Thread