Re: removing selection-highlight from NSTableView
Re: removing selection-highlight from NSTableView
- Subject: Re: removing selection-highlight from NSTableView
- From: Gore <email@hidden>
- Date: Wed, 23 Jan 2002 22:56:37 +0200
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.