Re: NSTableView and tableViewWillDisplayCell
Re: NSTableView and tableViewWillDisplayCell
- Subject: Re: NSTableView and tableViewWillDisplayCell
- From: email@hidden
- Date: Sun, 30 Sep 2001 21:27:24 -0400
On Sunday, September 30, 2001, at 08:21 PM, Simon Wright wrote:
>
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);
>
}
>
}
I'm not entirely sure about this really - but it looks like you aren't
returning the image unless you just left this out of your description of
the error. You want to implement this in your dataSource class:
public Object tableViewObjectValueForLocation(NSTableView tv,
NSTableColumn tc, int i)
{
try{
if(tc.identifier().toString().equals("statusColumn"))
{
if(statusArray.objectAtIndex(rowIndex) == "")
return statusGoodImage;
else
return statusBadImage;
}
}
catch(Exception e)
{ /* this whole try catch block is from another example - but i
don't have the 10.1 tools yet - so i didn't know what to remove and just
typed this in by hand. */
return "Exception (could be unlabeled identifier in IB)";
}
}
like i mention in the comment above - this is typed in to mail.app - so
there might be some bugs - but it should help...
good luck,
Tyler