Re: Buttons is NSTableView
Re: Buttons is NSTableView
- Subject: Re: Buttons is NSTableView
- From: John Hörnkvist <email@hidden>
- Date: Thu, 7 Feb 2002 00:31:16 +0100
On Thursday, February 7, 2002, at 12:02 AM, John C. Randolph wrote:
On Wednesday, February 6, 2002, at 05:06 AM, email@hidden
wrote:
Hello!
In iTunes the developers have very neat buttons in a NSTableView. Does
anybody know how to add buttons to a NSTableView like that?
iTunes doesn't contain any NSTableViews, sorry ;-) They implemented
their own controls that look a lot like NSTableViews..
iTunes has to support Mac OS 9, as well as Mac OS X, so it's a Carbon
app.
If you want to implement something like iTunes' checkboxes in the
"song" column, then you should make a delegate for your TableView, and
implement -tableView:willDisplayCell:forTableColumn:row:. That's your
opportunity to do whatever you like to the cell just before it draws.
You will also want to set the cell for the table column;
- (void)awakeFromNib
{
NSButtonCell* buttonCell=[[NSButtonCell alloc] init];
[buttonCell setButtonType:NSSwitchButton];
[buttonCell setTitle:nil];
[[tableView tableColumnWithIdentifier:@"enabled"]
setDataCell:buttonCell];
[buttonCell release];
}
Regards,
John Hornkvist
--
ToastedMarshmallow, the perfect Cocoa companion
http://www.toastedmarshmallow.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.