How to set checkbox state in TableView columnheader
How to set checkbox state in TableView columnheader
- Subject: How to set checkbox state in TableView columnheader
- From: "Zhang Li" <email@hidden>
- Date: Thu, 8 Oct 2009 16:23:46 +0800
Hi All,
I want to place a checkbox on each NSTableView column header, when user click on it, the checkbox can be set to checked/unchecked state accordingly.
I successfully put checkbox on NSTableView column header by using following code, I can see the checkbox there, but don't know how to change its value to on/off.
My code snippet is as below:
// Create CheckBox on Column Header
NSButtonCell *cell = [[ NSButtonCell alloc] init];
[cell setTitle:@"Checkbox"];
[cell setButtonType:NSSwitchButton];
[cell setBordered:YES];
[cell setImagePosition:NSImageLeft];
[aColumn setHeaderCell:cell];
[cell release];
By default checkbox is off state. I tried to use [cell setIntValue:NSOnState] before [cell release] to set the checkbox to on state, but failed. Looks like [NSButtonCell SetIntValue] is not the right way to change checkbox state.
Any help be deeply appreciated.
Echo
_______________________________________________
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