Re: NSTable and custom NSCell issues
Re: NSTable and custom NSCell issues
- Subject: Re: NSTable and custom NSCell issues
- From: Steve Israelson <email@hidden>
- Date: Fri, 23 Mar 2007 23:46:31 -0700
Actually I ended up implementing this storage mechanism as a delegate
method for the NSCell sub-class.
Works nicely.
Only about 6 lines of code.
On 23-Mar-07, at 11:21 PM, Steve Israelson wrote:
I think I have solved the problem.
My table objects being passed to my cell is a CoreData object, but
this solution could work with other cases using globals instead.
What I did was create a sub selection entity in core data.
It has fields for the table view, the cell item, and the sub item.
Basically there is one instance of this entity for each table view.
In the startTrackingAt method in the cell I calculate the sub item
clicked on and set this core data item.
The selection entity now has its cell item set and its sub item set.
Now, in my drawWithFrame method in my cell I check to see if there
is a selection entity for this table, and if that entity is for
this cell, if so I make use of its sub item info to draw the sub
item correctly.
I suppose I could just sub-class NSTable view and store this data
there. In fact that would be a good idea.
Might be a little work finding out what tableview this cell is in.
I guess I could add a protocol to the table sub-class and just walk
up the view hierarchy until an object that supports this protocol
is found.
Hmm, anyway, a solution like this seems to work.
Also, once the selected sub-item changes, I can broadcast a change
notification too.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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