Re: Table bindings to objects
Re: Table bindings to objects
- Subject: Re: Table bindings to objects
- From: Michael McCracken <email@hidden>
- Date: Tue, 19 Jul 2005 13:35:06 -0700
OK, so the table column is bound to the object, and your custom view
knows which attribute of the object to grab for display...
I'm pretty sure the editor uses whatever key you bound the column to,
so it's going to try to edit the object.
I guess you will need to override the editing behavior in your custom
cell as well. At least it can know the right key for editing.
Hopefully there's a simple override point, but I don't know any
details - sorry!
-mike
On 7/19/05, Jason Swain <email@hidden> wrote:
> My class is KVC compliant, but the issue is how does the cell editor know
> that it should edit the "name" property, rather than one of the other
> properties?
>
> My cell drawing method requires the whole object, or at least it uses
> -valueForKey to access the properties in the -setObjectValue method, but
> what property does the editor use to access the value?
>
>
> Jason
>
>
> On 19 Jul 2005, at 17:33, Michael McCracken wrote:
>
> Sounds you need to make sure that the objects you are using are KVC
> and KVO compatible. Google or Check the recent list archives for
> references to the KV* documentation (look for messages from mmalcolm
> crawford)
>
> -mike
>
> On 7/19/05, Jason Swain <email@hidden> wrote:
>
> I have a table column that is bound to an NSArrayController where the
> items are objects (i.e. not strings). I have not set a model key path
> to select a string value (e.g. the name method of my class). I then
> have an NSCell subclass that draws a representation of my object for
> each cell.
>
> I want the cell to be editable but this is not working. If I change
> the binding to point to a string rather than an object then editing
> does work, so I think I have narrowed it down to the fact that I am
> using an object for the cell data rather than a string. I have
> created the object class myself and have not implemented stringValue,
> objectValue etc. I was wondering if this was the problem? Should I be
> implementing some methods for conversion to/from a string for
> editing? Or am I going about this the wrong way, I'm just not sure
> how you are meant to structure something like this?
>
> Does anyone know how this should work?
>
>
> Jason
> _______________________________________________
> 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
>
>
>
>
> --
> Michael McCracken
> UCSD CSE PhD Candidate
> research: http://www.cse.ucsd.edu/~mmccrack/
> misc: http://michael-mccracken.net/blog/
>
>
>
>
> Jason Swain
>
> email@hidden
>
> mobile +44 7917 524 192
>
--
Michael McCracken
UCSD CSE PhD Candidate
research: http://www.cse.ucsd.edu/~mmccrack/
misc: http://michael-mccracken.net/blog/
_______________________________________________
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