• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSTableView and clipping
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTableView and clipping


  • Subject: NSTableView and clipping
  • From: Tobias Lidskog <email@hidden>
  • Date: Tue, 27 Aug 2002 03:49:25 +0200

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.

  • Follow-Ups:
    • Re: NSTableView and clipping
      • From: Tony Arnold <email@hidden>
  • Prev by Date: Dialing Problem Solved
  • Next by Date: Exporting NSImage
  • Previous by thread: Dialing Problem Solved
  • Next by thread: Re: NSTableView and clipping
  • Index(es):
    • Date
    • Thread