0
votes

When binding cells in my NSTableView of type NSPopUpButtonCell I got an error

[<NSTableColumn > valueForUndefinedKey:]: this class is not key value coding-compliant for the key value.

The reality is that I am simply after the contents of the NSPopUpButtonCell as a string

But i changed

NSString *name;

to

NSObject *name;

Which made my application LOAD but crash when trying to display the contents to a NSTableView that displays the NSPopUpButtonCell column

ERROR: unrecognized selector sent to instance

When I have an UNBOUND cell, i am not getting an error, further if the cell is type NSTextFieldCell i do not have a problem and can use the NSString class instead.

I am guessing that this is about connecting the right bits to everything, from what I can see on the error, So, how do i have the popup cell to display the popup button but save the value of the selected sell in the actual array?

Thanks

//------------------------------------------------
//my.h
//------------------------------------------------
@interface theItemsInArrayC : NSObject {
@private
    NSString *name;
    int age;
}
@property int age;
@property (copy) NSString *name;
@end

@interface mybigList : NSObject {
@private
    NSMutableArray  *theItems;
}
@property (copy) NSMutableArray  *theItems;
@end
//------------------------------------------------

AND

//------------------------------------------------
//my.m
//------------------------------------------------
@implementation theItemsInArrayC
@synthesize name;
@synthesize age;
- (id)init
{
    self = [super init];
    if (self) {
        age = 19;
        name = @"Another Name";
    }
    return self;
}
@end

@implementation mybigList
@synthesize theItems;
- (id)init
{
    self = [super init];
    if (self) {
        theItems = [[NSMutableArray alloc] init];
    }
    return self;
}
@end
//------------------------------------------------
1
Please describe the binding(s) you've set on the table column: which binding(s)? Bound to what? What controller key? What model key path?Ken Thomases
i actually found that the prior to converting the cell to popup it was text and bound, when i converted to popup it kept a stray binding down the bottom, removing that stray was what fixed my issueJackie Lambert

1 Answers

0
votes

I found the sample code for what i wanted to do at https://github.com/johnjohndoe/NSPopUpButtonCell

i hope this helps the next person! and also a big thank you to that person on github toooooooo