Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTableView and tableViewWillDisplayCell



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


References: 
 >NSTableView and tableViewWillDisplayCell (From: Simon Wright <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.