Re: Modify the background color of a row in NSTableView with Images and Buttons
Re: Modify the background color of a row in NSTableView with Images and Buttons
- Subject: Re: Modify the background color of a row in NSTableView with Images and Buttons
- From: email@hidden
- Date: Tue, 8 Apr 2003 11:48:23 -0700
This is discussed a lot in the archives of this list, at
<
http://cocoa.mamasam.com/>
Risposta semplice: See my source code at
<
http://www.gigliwood.com/tabletester/>
Regards,
Dan Wood
On Tuesday, April 8, 2003, at 09:25 AM, Giovanni Donelli wrote:
Hello folks,
I have a NSTableView which I subclass and I added few columns so that
they could hold a NSImageCell and a NSButtonCell, so now I'm able to
display images and Buttons there... actually all very simple as well as
cool...
The problem is... that I want now to add color my rows in the same ways
as iTunes does with its mp3 's playlists... alternate the color of the
lines.. so I used this delegate method:
- (void)tableView: (NSTableView *)aTableView willDisplayCell:(id)aCell
forTableColumn:(NSTableColumn *)TC row:(int)row
{
if ( (row % 2) == 0)
{
[aCell setDrawsBackground: YES];
[aCell setBackgroundColor:
[NSColor colorWithCalibratedRed: 0.9 green: 0.9 blue:1 alpha:
1.0]];
}
else
{
[aCell setDrawsBackground: NO];
[aCell setBackgroundColor: [NSColor whiteColor]];
}
}
But this works correctly with the normal text cell (which should be an
instance of NSTextFieldCell) not so well which the other cells,
actually the application crashes...
Does anybody know how to change the background of a NSButtonCell and of
NSImageCell? or a way to solve the problem I have ;-)
any advice will be very appreciated...
thanks you very much for reading me!
John
_______________________________________________
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.
--
Dan Wood
Karelia Software, LLC
email@hidden
http://www.karelia.com/
Watson for Mac OS X:
http://www.karelia.com/watson/
The information contained in this message or any of its attachments may
be privileged and confidential and intended for the exclusive use of
the addressee(s). Any disclosure, reproduction, distribution or other
dissemination or use of this communication is strictly prohibited.
The Arrogance of Power: <
http://www.fatdawg.com/senbyrd.html>
_______________________________________________
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.