• 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: The problem with bindings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: The problem with bindings


  • Subject: Re: The problem with bindings
  • From: Steve Sims <email@hidden>
  • Date: Fri, 30 Jul 2004 19:34:17 -0400

On 30 Jul 2004, at 17:15, Allan Odgaard wrote:

On 30. Jul 2004, at 21:34, Steve Sims wrote:

For example one thing that I wanted to do was react to changes in any key within a "container" object inside my model. Observing for changes in "container" don't work - you need to observe for "container.key1", "container.key2" and "container.key3". This didn't make sense to me, since if "container.key1" changes then logically "container" has changed too by my way of thinking. Which reminds me, I should file an enhancement request on that one.

Not really feasible, e.g.:

id obj = [NSMutableDictionary dictionary];
[array1 addObject:obj]; // ivar
[array2 addObject:obj]; // ivar

[obj setValue:foo forKey:@"bar"];

This should then generate change notifications for both array1 and array2, and since someone may have the object holding the arrays as ivar, another change notification should then be generated for that object a.s.o., so this will cascade beyond control (not to forget that the actual object changed, rarely have back-links to follow for these notifications to be sent).

OK, I see your point here, but I'm coming at this from bindings.

Let's take a couple of real examples here to illustrate what I'm after.

Within my app, FontFX7, I have a UI hooked up to my data model, and within that model is structured data. My UI binds to my model using key paths such as "fontParams.size.width". Ideally what I want to do is observe for changes to "fontParams.size" to react to changes to both the "width" and "height" parameters contained within there. Unfortunately I can't do that and have to specifically observe for both "fontParams.size.width" and "fontParams.size.height".

It seems to me that it would be really easy for the bindings system to tell me that "fontParams.size" (and indeed "fontParams") had changed when a change is made to one of the values contained within it.

Another example of where this would be useful is in enabling/disabling UI controls with bindings. A specific example here is in my UI for FontFX7 I wanted to be able to enable a pop-up based on a complex criteria of various variables inside "effectParams" in my data model. These variables though get changed through bound UI controls. Right now my UI works by binding to a derived value within my data model, and I use manual observer notification in the setter methods of the dependent keys.

Now this method works fine, but it makes me slightly uncomfortable since I have some UI logic residing within my data model. If I could bind to "effectParams" and use a value transformer to derive my YES/NO value I'd be much happier - the UI logic would be where it belongs.

I do see the point that you're making, but I wasn't really asking for that much. To mix our examples if "foo = fontParams.size" then I would not actually expect to see a notification that "fontParams.size" had changed if "foo.width" was adjusted. You are right - that kind of thing would be very difficult indeed. What I'm suggesting though is much simpler.

Steve
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: The problem with bindings
      • From: Allan Odgaard <email@hidden>
References: 
 >The problem with bindings (From: Drew McCormack <email@hidden>)
 >Re: The problem with bindings (From: Steve Sims <email@hidden>)
 >Re: The problem with bindings (From: Gwynne <email@hidden>)
 >Re: The problem with bindings (From: Steve Sims <email@hidden>)
 >Re: The problem with bindings (From: Allan Odgaard <email@hidden>)

  • Prev by Date: Re: What does it mean when po puts % before class name?
  • Next by Date: User Startup Bundle
  • Previous by thread: Re: The problem with bindings
  • Next by thread: Re: The problem with bindings
  • Index(es):
    • Date
    • Thread