On Oct 8, 2009, at 1:23 AM, Zhang Li wrote: > 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];
What you are doing will not work. /* Gets and sets the headerCell associated with this NSTableColumn. 'cell' must be non nil, and should be a member of the NSTableHeaderCell class. The 'headerCell' is a strong reference, and will be retained. */ - (void)setHeaderCell:(NSCell *)cell; - (id)headerCell; You have to create an NSTableHeaderCell subclass. Even then, you may have to subclass NSTableHeaderView to get it to work like a button with a button in it (header's are essentially buttons). --corbin _______________________________________________ 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