Re: removing selection-highlight from NSTableView
Re: removing selection-highlight from NSTableView
- Subject: Re: removing selection-highlight from NSTableView
- From: Gore <email@hidden>
- Date: Thu, 24 Jan 2002 08:04:31 +0200
WOW!, it worked!, thx again man hehe
I've added some grid and alpha to the tableview and it looks just great!
have fun...
/ Gore
On Thursday, January 24, 2002, at 01:00 , Ryan Dingman wrote:
Sorry. I should have tested this. You can finish off the job by
adding the following to your subclass.
- (NSColor *)_highlightColorForCell:(NSCell *)cell;
{
return [NSColor redColor];
}
Keep in mind that this is a _private_ method. So it could disappear in
future releases of Mac OS X.
Hope this helps.
ryan
On Wednesday, January 23, 2002, at 12:56 PM, Gore wrote:
hmmm...that gray highlight color is still there somehow...
but yes it works...it draws the red line under my content but it
include that highlight color too =(((
and the gray highlight color only fills parts of the content, hmmm...
On Wednesday, January 23, 2002, at 10:46 , Ryan Dingman wrote:
Instead, try implementing:
- (void)highlightSelectionInClipRect:(NSRect)clipRect;
If you want to highlight all selected rows as red then you could do
something like the following:
- (void)highlightSelectionInClipRect:(NSRect)clipRect;
{
NSEnumerator *rowEnumerator;
NSNumber *rowIndex;
rowEnumerator = [self selectedRowEnumerator];
while ((rowIndex = [rowEnumerator nextObject]) != nil) {
NSRect rowFrame;
rowFrame = [self rectOfRow:[rowIndex intValue]];
if (NSIntersectsRect(rowFrame, clipRect) == YES) {
[[NSColor redColor] set];
[NSBezierPath fillRect:rowFrame];
}
}
}
If you didn't want any highlighting to occur at all you could just
override this method to do nothing:
- (void)highlightSelectionInClipRect:(NSRect)clipRect;
{
}
Also, keep in mind that columns can be selected. Neither of my
implementations take this into account.
Hope this helps.
ryan
On Wednesday, January 23, 2002, at 12:19 PM, Gore wrote:
I would like to remove the highlight color when selecting a item in
a NSTableView, my subclass code looks like this, but the orginal
highlight is drawn too...
- (void)drawRow:(int)row clipRect:(NSRect)rect
{
if ( [self isRowSelected: row] )
[[NSColor redColor] set];
[[NSBezierPath bezierPathWithRect: [self rectOfRow: row]] fill];
// to draw the item content...but the highlight is drawn too!
[super drawRow: row clipRect: rect];
}
I must use [super drawRow: row clipRect: rect]; so that the content
of the rows are drawn too, but that draws the highlight thingy too I
think, hmmm...I've tryed using [self setNeedsUpdate: YES]; instead
of the super-call but doesn't work. Is there a good way to do this ?
The most logical solution must be to somehow refresh the content,
but how ?!
_______________________________________________
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.
_______________________________________________
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.