Re: Really frustrated with NSButtonCell
Re: Really frustrated with NSButtonCell
- Subject: Re: Really frustrated with NSButtonCell
- From: Kris Amico <email@hidden>
- Date: Fri, 28 Feb 2003 11:45:35 -0800
NSTableView employs a prototype pattern to make its cells. Each column has
some NSActionCell subclass (NSTextFieldCell by default) instance as its
prototype, and the column's cells are copies of that object. All you need to
do is make a new prototype object and give it to the NSTableColumn object in
question:
// set cell prototype for checkbox column:
NSButtonCell* checkCellPrototype = [[[NSButtonCell alloc] init]
autorelease];
[checkCellPrototype setButtonType:NSSwitchButton];
NSTableColumn* checkColumn = [mUpdateTable
tableColumnWithIdentifier:@"myColumn"];
[checkColumn setDataCell:checkCellPrototype];
For your case, I would recommend having a column for your checkbox and a
column for your song title next to it. Otherwise, it seems you are going to
have to make some sort of hermaphroditic NSActionCell subclass.
On 2/28/03 3:54 AM, "Chad Armstrong" <email@hidden> wrote:
>
I'm trying to create a one column table which has a NSButtonCell which can
>
display a switch button and a string of text. I even tried to create a new
>
class which contains the switch button and an NSString.
>
>
I've found some comments to check out the source code of OpenUp from the
>
softrack.stepwise.com site, but this always ends up with a non-responding
>
link.
>
>
Does someone have some working source code which displays how to get a simple
>
NSButtonCell to work in a table? This would look similar to the Song Name
>
column in iTunes, except my app would have only one column. I also want the
>
ability to change the name of the string and change the switch button, just
>
like in iTunes.
>
>
To add a new item, there is a text field where the string is added, and then
>
the string is added with the switch button not selected.
>
>
Thanks for assistance.
>
>
Chad Armstrong
>
_______________________________________________
>
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.
--
Kris Amico <email@hidden>, AIM: Kris Amico
Senior Software Engineer
Macintosh Client Software Development
EarthLink, Inc.
_______________________________________________
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.