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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to