Re: NSTableView and clipping
Re: NSTableView and clipping
- Subject: Re: NSTableView and clipping
- From: Tony Arnold <email@hidden>
- Date: Tue, 27 Aug 2002 13:27:06 +1000
Tobias,
Take a look @ the code I've been working on:
http://homepage.mac.com/tonyarnold/
It borrows heavily from work done by Brad Brack, but draws authentic
iTunes listings quite to my liking :).
-Tony
On Tuesday, Aug 27, 2002, at 11:49 Australia/Sydney, Tobias Lidskog
wrote:
Hi all
I have a NSTableView subclass where I'd like to draw vertical grid
lines, iTunes style. To do this I override -
(void)drawGridInClipRect:(NSRect)r. Normally this works great and my
lines are drawn in the whole view, including below the last row with
contents. Resizing the view and reordering columns is fine too.
However when I resize a column only the part where the actual rows are
gets redrawn. The area below the last row (actually below last row +
1) isn't touched, and the vertical grid lines are still drawn at the
old position in that area. Resizing the view restores the grid. I'm
guessing that my drawing are clipped somehow, but I've been
unsuccessful in my attempts to change the clipping. Is it possible to
make this work (if so, how?) or do I have to change my strategy? My
current code is shown below, full sample project available upon
request.
/Tobias
p.s. Sorry if this gets posted twice, I sent it from the wrong account
at first d.s.
- (void)drawGridInClipRect:(NSRect)r {
[NSGraphicsContext saveGraphicsState];
// alter clip rect
[NSBezierPath clipRect: [self visibleRect]];
[NSBezierPath setDefaultLineWidth:0.0];
// iterate through columns and draw vertical lines using
[NSBezierPath strokeLineFromPoint:...]
// the lines are normally drawn correctly
...
// restore clip rect
[NSGraphicsContext restoreGraphicsState];
}
_______________________________________________
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.
thanks,
Tony Arnold
|============---
| Web Designer / Blackboard Support Officer
| Communication & Information Services
| University Services Division
| University of Newcastle, Australia
| (02) 4921 6776
| ============---
| "I can only please one person per day. Today is not your day.
| Tomorrow is not looking good either."
|============---
_______________________________________________
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.