Hello,
I've setup an NSOutlineView with 2 colums: the first one named "buttonColumns"
with NSButtonCell (Switch ON / OFF)
and the second one with TextFieldCell…
While the state change works for NSButtonCell in the buttonColum I had to
create an NSArray *checks to set it ON or OFF.
Is there an easier way to change the state of an NSButtonCell in an
NSOutlineView without using an NSArray ?
The code I'm using seems a little bit overkill for me...there must be a simpler
solution...
Here's what I've done so far and it works:
// init code
checks = [[NSMutableArray alloc] init];
for ( int i=0; i < NBR_OF_ROWS; i++ )
[checks addObject:[NSNumber numberWithInt:0]];
// NSOutlineView datasource methods
- (id)outlineView:(NSOutlineView *)outlineView
objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item
{
id theValue;
NSInteger selectedRowIndex = [outlineView selectedRow];
if ( [[tableColumn identifier] isEqualToString:@"buttonColumn"] )
{
theValue = [checks objectAtIndex:selectedRowIndex];
}
return theValue;
}
- (void)outlineView:(NSOutlineView *)outlineView setObjectValue:(id)object
forTableColumn:(NSTableColumn *)tableColumn byItem:(id)item
{
NSInteger selectedRowIndex = [outlineView selectedRow];
if ( [[tableColumn identifier] isEqualToString:@"buttonColumn" ])
{
[checks replaceObjectAtIndex:selectedRowIndex withObject:object];
}
}
Does someone have any clue ? Any help is greatly appreciated ?
Cheers,
Gilles
_______________________________________________
Cocoa-dev mailing list ([email protected])
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 [email protected]