Re: Checking facts on NSCell (e.g. in NSTableView)
Re: Checking facts on NSCell (e.g. in NSTableView)
- Subject: Re: Checking facts on NSCell (e.g. in NSTableView)
- From: Graham Cox <email@hidden>
- Date: Thu, 8 Jan 2009 19:42:56 +1100
On 8 Jan 2009, at 7:31 pm, Luke Evans wrote:
By way of further example, if you had a data model containing some
objects that have, say, an NSColor property, and you want to paint a
simple colour swatch in a custom cell, is there no simple way of
binding the NSColor value to the cell and picking this up in the
cell? Perhaps one has to resort to subclassing the control somehow
to get richer forms of cell instantiation if this is needed???
I'm not sure how bindings affects the picture, but I've found that the
limitations of the initWithImage;/initWithText: don't really matter.
After all, you never call them, the table (column) does.
There is only one cell per column, and it "moves" from row to row as
it is drawn. The dataSource set the cell's objectValue on the fly. The
cell can access its own objectValue in its drawing methods and do
whatever, and the objectValue can be anything at all, including some
custom class of your own devising. I've had no trouble using NSColor
here and other classes too.
I don't think the representedObject will help you in the case of a
table view because of the single cell per column.
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden