On Sun, Jul 13, 2008 at 6:59 PM, Paul Williams <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am trying to find a way where I can use a NSTableView to display a list of
> buttons(NSButtonCell) which can be hidden depending on the state of the
> program.
> I have tried using a custom NSCells, but the only object I can can pass to
> my custom cell is a NSCFBoolean.
> Is there a way I can pass more information to my custom cell so I can have a
> button which can be set to On,Off or hidden.

There are two ways to give more information to your custom cell:

- Use an NSDictionary or an instance of a custom class as your object
value. If you're using a data source, return this object in your
objectValueForTableColumn method. If you're using bindings, bind the
array to a key path which produces this object. In both cases, this
dictionary or custom object will be passed to your cell's
-setObjectValue: method, and then you can do whatever you want with
its contents.

- Implement the willDisplayCell delegate method. This method is called
just before the cell is displayed, and at that point you can do
whatever you want to it based on the column/row information provided.
Depending on exactly what you need, you may not even need to implement
an NSCell subclass if you use this approach, if you can customize
NSButtonCell sufficiently.

Mike
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to