• 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
PopupButtonCell in a TableView column
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PopupButtonCell in a TableView column


  • Subject: PopupButtonCell in a TableView column
  • From: Lynn Barton <email@hidden>
  • Date: Thu, 04 Mar 2010 11:03:49 -0800

I am trying to display my model data in an NSTableView where one integer property is represented by a popup menu in the first column of the table. I have searched the archives and seen that some others have done the same and asked for assistance, but none of the answers I found were complete enough for me to find the solution.

With a model entity of (let's say) MyData and an array controller of MyDataArrayController, and two properties myIntProperty and myStringProperty, the tableview works perfectly without the popup menu. In this case, the first column has a text cell and a number formatter, and the column is bound to MyDataArrayController.arrangedObjects.myIntProperty. The second column is bound to MyDataArrayController.arrangedObjects.myStringProperty.

Then I created another array controller, MyMenuArrayController (super is NSArrayController), which builds a fixed array of 3 NSStrings. That array becomes the arrangedObjects property of the controller.

After removing the number formatter, and placing an NSPopupButtonCell in the first column of the table, I have tried many different bindings, and none of them worked. I always get the console error message " [<NSTableColumn 0x200083e20> valueForUndefinedKey:]: this class is not key value coding-compliant for the key value."

The problem is made worse by the fact that even if I reverse the changes made from the previous, working configuration, putting the text cell and the number formatter in place of the popupbutton cell, the same error occurs. I have to use Time Machine to load the previous project files in order to get rid of the error.

(1) What key value should be used with an NSString object in an array? "description" perhaps?
(2) What are the correct bindings to use?
(3) When the user changes the selected  item in the popup menu, will that be automatically reflected in the value of myIntProperty?
(4) Why does the error persist after I reverse the changes to the tableview?
(5) Am I not providing the menu's array of strings in a correct way?

This has me stumped, so any help will be greatly appreciated.

Lynn Barton
_______________________________________________

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

  • Prev by Date: Re: Uninitialized rectangle??
  • Next by Date: Re: Uninitialized rectangle??
  • Previous by thread: Re: Anti-aliasing in Snow Leopard (10.6) PDFView
  • Next by thread: Re: PopupButtonCell in a TableView column
  • Index(es):
    • Date
    • Thread