• 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 tableViewWillDisplayCell
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTableView and tableViewWillDisplayCell


  • Subject: NSTableView and tableViewWillDisplayCell
  • From: Simon Wright <email@hidden>
  • Date: Sun, 30 Sep 2001 20:21:07 -0400

I have an NSTableView which has a column in which I'd like to place a small graphic (in this case it represents the status of something that the row refers to). For example I'd like to put a green square when the status is good and a red square when trouble looms.

I have created a couple of jpegs and loaded them into NSImage objects like this...

statusGoodImage = new NSImage("StatusGood.jpg", true);
statusBadImage = new NSImage("StatusBad.jpg", true);

I have created my own cell like this...

private static NSImageCell statusCell = new NSImageCell();

I have changed the appropriate cell from test to image like this...

NSTableColumn statusTableColumn = aTableView.tableColumnWithIdentifier(
"statusColumn");
statusTableColumn.setDataCell(statusCell);

and I have a method that does the tableViewWillDisplayCell stuff like this.
..

public void tableViewWillDisplayCell(NSTableView aTableView, NSCell aCell, NSTableColumn aTableColumn, int rowIndex) {
NSApplication.beep(); //let me know if it's getting called
if (aTableColumn.identifier().toString().equals("statusColumn")) {
if (statusArray.objectAtIndex(rowIndex) == "")
aCell.setImage(statusGoodImage);
else
aCell.setImage(statusBadImage);
}
}

but it is never getting called when my table is displayed. How does my tableview know that it should be calling this method. I'm sure I'm missing some vital "connection". Your help is appreciated.

Simon

(Hoping that one he'll be able to help others on this list).


  • Follow-Ups:
    • Re: NSTableView and tableViewWillDisplayCell
      • From: email@hidden
  • Prev by Date: Re: How to determine a single pixels alpha?
  • Next by Date: Re: Odd stuff with Cocoa-Java
  • Previous by thread: DiscBurning Framework?
  • Next by thread: Re: NSTableView and tableViewWillDisplayCell
  • Index(es):
    • Date
    • Thread