NSbuttonCell's Bound Title Misbehaving
NSbuttonCell's Bound Title Misbehaving
- Subject: NSbuttonCell's Bound Title Misbehaving
- From: Ian was here <email@hidden>
- Date: Tue, 22 Jul 2008 10:56:10 -0700 (PDT)
I have a table with one column. This column uses NSButtonCells.
I have an array controller whose object class is NSMutableDictionary. It uses two keys: "value" and "state". Value is the string that will be used as the title for a button cell. State is the state of the button cell, which is a check box. The states being checked or unchecked (NSOnState or NSOffState).
The table column's value is bound to the array controller. The controller key being "arrangedObjects" and the model key path being "value".
The NSButtonCell (which is attached to the column via Interface Builder) has its value bound to the array controller as well. The controller key is "selection" and the model key path is "state".
Finally, I have a table delegate method which is as follows...
- (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
{
NSArray *arrangedObjects = [myArrayController arrangedObjects];
NSMutableDictionary *anObject = [arrangedObjects objectAtIndex:rowIndex];
NSString *myValueString = [anObject objectForKey:@"value"];
[aCell setTitle:myValueString];
}
Ideally, this would display all of the check boxes in the table column, with their respective titles and their current state (checked or unchecked).
Everything looks perfect when I first run the app. The check boxes show their correct state and the titles are correct. The problem is when I click on a check box. If I check a box, its title changes to "1" and if I uncheck a box, its title changes to "0". Has anyone had this problem before?
_______________________________________________
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