• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: programmatically updating an MO's attribute/field
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: programmatically updating an MO's attribute/field {MOC is updated, but data is NOT stored}
      • From: "Frederick C. Lee" <email@hidden>
    • Re: programmatically updating an MO's attribute/field
      • From: "Frederick C. Lee" <email@hidden>
  • Prev by Date: Re: How to deal with Java Script in None-GUI applications?
  • Next by Date: Re: title bars messed up when scrolling in NSTableView
  • Previous by thread: Re: [SOLVED] title bars messed up when scrolling in NSTableView
  • Next by thread: Re: programmatically updating an MO's attribute/field
  • Index(es):
    • Date
    • Thread