• 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: Cocoa bindings one- or bi-directional
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa bindings one- or bi-directional


  • Subject: Re: Cocoa bindings one- or bi-directional
  • From: Zdzislaw Losvik <email@hidden>
  • Date: Fri, 27 May 2005 11:49:45 +0200

This is at best misleading. The code specifies binding, not observing. The basic goal of binding is to keep two values synchronised. If you use the bind:... method to bind a text field's 'value' to a keypath in an object controller, you could get the expected behaviour.

I have read a dozen of articles about bindings. Some of them were great. When I was done I was convinced that bindings always work two- ways. The basic article by Apple about a joystick ( HowDoBindingsWork ) has lots of sample impementation code. Although I have read it several times, until yesterday, I was sure that this glue code is already implemented in NSObject. But NO, user has to write it for his class by himself. Basic NSView subclasses have these methods implemented, but when you use your custom view this has to be added.


I have tried rewriting my code to bind brick1 to NSObjectController (brick2) - it makes no difference. brick1 observes brick2, but reverse is not true.

So that nobody would complain that I am having a bad practice of not using controller and binding two model objects together - in my application bindigns look this way:
NSViewSubclass bound to NSObjectController that controlls NSObjectSubclass
And it makes no difference. Also please note that according to Apples documentation binding two objects together is perfectly legal, just some minor features (NSEditor and NSEditorRegistration protocols, placeholder and multiselection values) are lost.


Also I do not access private variables this way: brick1->intValue. I did it here on purpose as I wanted to make sure that no binding magic happens behind the scene when I access these values and that I get the value that really is there.

It seems to me that bindings are not fully implemented in Mac OS X. It is just a bit odd that so much advertised technology does not work as it is supposed to. Values are not kept in sync. Probably there was a reason of doing so.

_______________________________________________
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: Cocoa bindings one- or bi-directional
      • From: Scott Anguish <email@hidden>
    • Re: Cocoa bindings one- or bi-directional
      • From: mmalcolm crawford <email@hidden>
    • Re: Cocoa bindings one- or bi-directional
      • From: mmalcolm crawford <email@hidden>
References: 
 >Cocoa bindings one- or bi-directional (From: Zdzislaw Losvik <email@hidden>)
 >Re: Cocoa bindings one- or bi-directional (From: Kay Roepke <email@hidden>)
 >Re: Cocoa bindings one- or bi-directional (From: mmalcolm crawford <email@hidden>)

  • Prev by Date: Re: Cocoa bindings one- or bi-directional
  • Next by Date: Re: Cocoa bindings one- or bi-directional
  • Previous by thread: Re: Cocoa bindings one- or bi-directional
  • Next by thread: Re: Cocoa bindings one- or bi-directional
  • Index(es):
    • Date
    • Thread