Re: programmatically updating an MO's attribute/field
Re: programmatically updating an MO's attribute/field
- Subject: Re: programmatically updating an MO's attribute/field
- From: Matt Neuburg <email@hidden>
- Date: Mon, 30 Jan 2006 10:38:08 -0800
- Thread-topic: programmatically updating an MO's attribute/field
On Mon, 30 Jan 2006 10:20:41 -0800, "Frederick C. Lee"
<email@hidden> said:
>Greetings:
> Here's the scenario:
>
>'MO' = Customized NSManagedObject.
>
>1) I have an unbound NSTextView on my main page that can supply info
>to any MO.
>2) I have access to a number of NSArrayControllers (and hence, their
>MOs) from my program.
>3) I also have any MO's ObjectID, depending which is "in focus".
>
>Goal: Merely programmatically update an attribute/field within the
>target NSManageObject.
>That is, stuffing a NSAttributeString into the target's MO's
>transient field. The MO's accessor will transform the transient
>field into a binary object for storage.
>
>I'm thinking via their respective NSArrayControllers' instances.
>
>Must I actually build a new object and replace the target object
>within NSArrayController?
>Or can I just update a attribute/field within the object (preferred
>way)?
>
>Question: What's the most efficient/safe way to connect to a target
>NSManagedObject (depending on the Context of the situation)?
>That is, keeping GUI & MOC in sync and happy.
Accepting that for some reason you don't want to use bindings up front (at
least I assume you don't, since you say this NSTextView is unbound), why not
just do it the old-fashioned way? Simply call the MO's setValue:forKey: as
necessary. You will presumably want some way of knowing when it is time to
do this, so you'll probably want to set up a delegate for the text view (or
in some other way get a signal from the interface). m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide
<http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt>
_______________________________________________
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