• 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
Binding a popup button's selected index to a model integer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Binding a popup button's selected index to a model integer


  • Subject: Binding a popup button's selected index to a model integer
  • From: Johnny Lundy <email@hidden>
  • Date: Tue, 29 Apr 2008 12:14:35 -0400

Hello all,

I would appreciate some guidance in getting a popup button to use its selectedIndex to set an integer in my model.

I am having trouble understanding how to properly bind the selection of a popup to an integer in the model so that changes in the popup's selection changes the model integer's value.

My popup button's content is correctly set through its array controller to an array in my model.

I want to have the popup's set my model integer to the popup's selected item's index so that I may use the integer in my code to select the proper element in my model array. Thus I want changing the popup to KVC change the value of the integer model object gameType (NSInteger *, KVO compliant).

I have tried setting the popup's "selected index" binding to this NSNumber * model object.
I tried setting the popup's array controller's selectedIndex to the NSNumber * model object.
I tried making the model integer variable be a plain NSUInteger instead of an object.
None of these seem to activate the proper Cocoa Bindings mechanism.


I keep getting the usual

"2008-04-29 11:30:01.441 MafiaC9Arrays[29820:10b] Cocoa Bindings: Error accessing value for key path selectionIndex.gameType of object <NSArrayController: 0x1018870>[object class: NSString, number of selected objects: 0] (from bound object <NSPopUpButton: 0x1024090> with object ID 1475 in Nib named MainMenu.nib): [<NSCFNumber 0x10551d0> valueForUndefinedKey:]: this class is not key value coding- compliant for the key gameType."



I appreciate any guidance on this.

Johnny


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Binding a popup button's selected index to a model integer
      • From: "I. Savant" <email@hidden>
  • Prev by Date: Re: Counting instances in Core Data
  • Next by Date: Re: Binding a popup button's selected index to a model integer
  • Previous by thread: Re: Counting instances in Core Data
  • Next by thread: Re: Binding a popup button's selected index to a model integer
  • Index(es):
    • Date
    • Thread