• 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: Re: Confused about bindings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re: Confused about bindings


  • Subject: Re: Re: Confused about bindings
  • From: "Julien Jalon" <email@hidden>
  • Date: Sun, 19 Nov 2006 17:30:25 +0100

On 11/19/06, David Aames <email@hidden> wrote:
Okay... Thanks for the explanation. But as I was reading through the
docs ("View Initiated Updates", Bindings Programming Guide) it says
the view has to send the new values to the controller ("Communicate
view values to the controller to which it is bound") and the method
call they show is:
[observedObjectForAngle setValue: newControllerAngle forKeyPath:
observedPathForAngle];
But doesn't this actually bypass the controller? E.g. the
observedPathForAngle might be @"selection.shadowAngled" so what this
call is doing is just getting [observedObjectForAngle selection] and
calling the setValue method on the selection so it actually
communicates the values to the model and not the controller.

-[NSController selection] returns a proxy (managed by the controller) to the model object. You don't bypass the controller.

So are
we actually supposed to use KVC to update the model objects ourselves
(i.e. implement in on our own in our custom views)? If that is the
case wouldn't it be better to implement the updating in the setters
and not in updateForMouseEvent: as it is shown in the docs? Thanks.


Yes: your custom views has to handle the whole stuff itself (and that's where Apple documentation and code examples is a little bit lacking)

No: you should consider that your setters in your view are not a way
to modify the model but a way for the controller to reflect model's
changes. (and in facts, you can test that using -[NSControl setValue:]
directly won't change the model's value and will likely to make your
control out-of-sync with the model).

--
Julien
_______________________________________________
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: Confused about bindings
      • From: mmalc crawford <email@hidden>
References: 
 >Confused about bindings (From: David Aames <email@hidden>)
 >Re: Confused about bindings (From: "Julien Jalon" <email@hidden>)
 >Re: Confused about bindings (From: David Aames <email@hidden>)

  • Prev by Date: Re: Core Data And Required Bindings
  • Next by Date: Re: Confused about bindings
  • Previous by thread: Re: Confused about bindings
  • Next by thread: Re: Confused about bindings
  • Index(es):
    • Date
    • Thread