• 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
Graphics artifacts in NSMatrix
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Graphics artifacts in NSMatrix


  • Subject: Graphics artifacts in NSMatrix
  • From: Peter Ammon <email@hidden>
  • Date: Thu, 8 Nov 2001 17:12:25 -0500

I am trying to implement an NSMatrix of my custom cells. To highlight the cells, I do something like this in the cell class:

- (void)drawWithFrame:(NSRect)frame inView:(NSMatrix*)view {
BOOL isSelected=([[view selectedCells] indexOfObjectIdenticalTo:self] != NSNotFound);
if (isSelected) {
//draw with highlights
}
else {
//draw without highlights
}
}

This works very well, except when I select a new cell in the matrix, it doesn't redraw the old selected cell, so that the old selected cell continues to appear highlighted until I scroll it offscreen and back on.

I've tried forcing it to redraw the old cell by overriding the NSMatrix's mouseDown: method, and that works but still looks a little weird: the old cell isn't unhilighted until after the new cell is highlighted.

Can anyone suggest a way around this?

Also, how on earth does the NSMatrix keep track of the selected cells? I've tried overriding selectCell: and selectCellAtRow: column:, but neither get called when I click on a cell. Also, I can't see any ivars in the NSMatrix that could store the selected cells (unless it's that one opaque void*)

-Peter


  • Follow-Ups:
    • Re: Graphics artifacts in NSMatrix
      • From: "Erik M. Buck" <email@hidden>
  • Prev by Date: Re: Loadable Nib Views
  • Next by Date: Re: Loadable Nib Views
  • Previous by thread: Re: Loadable Nib Views
  • Next by thread: Re: Graphics artifacts in NSMatrix
  • Index(es):
    • Date
    • Thread