Re: NSView as dataCell in TableView
Re: NSView as dataCell in TableView
- Subject: Re: NSView as dataCell in TableView
- From: Mike Abdullah <email@hidden>
- Date: Thu, 23 Mar 2006 21:08:20 +0000
It's possible to use an NSView subclass as a table cell, but rather
tricky since NSTableView is meant to handle NSCells.
What I have found to work (and I may have ended up with quite a messy
solution) is as follows:
* Create an NSObject subclass that will act as the controller for
your NSView subclass. I will refer to it as viewController from now on
* One of the methods of viewController should return the view which
it manages.
* Since you are adding items to a table, presumably they are in an
array. The contents of the array should be viewControllers.
* Create a NSCell subclass and tell the table view that this is the
cell class to be displayed in the table.
* Now I don't know if you are using bindings, because if so, this
simplifies this task. Basically you need it so that objectValue of
the cell is the view which your eventController manages.
* When your NSCell is asked to draw itself (drawFrame:inView I think)
it should simply make its objectValue a subview of the view it is
drawing in (remember objectValue is your NSView subclass!) and set
the frame of objectValue to be the frame it is asked to draw in.
This has worked pretty well for me, BUT it probably isn't the best
way of doing things. If you are working with bindings I can send you
my project for my custom system like this, but it may be a little
tricky to disect!
Mike.
On 23 Mar 2006, at 18:46, Lorenzo wrote:
I would like to set my custom NSView as dataCell in a "one-column"
tableView.
Actually I can just set a check-box dataCell or an ImageCell...
Instead I would like to set my custom NSView containing buttons,
sliders,
custom ImageViews... then I set this view as "the" row of the table
and when
the user clicks on one of its outlets I process the outlet 's
IBAction & the
selected row. I'd do the same to set the outlet to the row values.
Can I do that? Any idea?
Best Regards
--
Lorenzo
email: email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden