Using bindings to trigger observer when contents of array change
Using bindings to trigger observer when contents of array change
- Subject: Using bindings to trigger observer when contents of array change
- From: Bill Cheeseman <email@hidden>
- Date: Sat, 25 Jun 2005 06:08:00 -0400
on 2005-06-25 5:44 AM, mmalcolm crawford at email@hidden wrote:
> If you're binding to key-value pairs *within* the dictionary, then
> when you modify a value you're not changing the dictionary itself.
> The same dictionary instance is used throughout. Therefore the
> validation method for that instance is not invoked.
mmalc, I'm running into this same issue in a different situation, and I
can't figure out how to deal with it.
I want to trigger an observer when an element is added to or removed from an
array controller. (Basically, I want a popup to be disabled via bindings
when its content array is emptied, then re-enabled when something is added
to its content array.) Watching for the controller's @count to become zero
doesn't work, because the observer is watching the array and, as you say,
the array isn't changed by the addition or removal of an element.
Is the answer simply that this isn't a proper use for bindings? I could
certainly declare an iVar for the popup and explicitly enable and disable it
in an action method if appropriate every time an element is added to or
removed from the content array.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
PreFab Software - http://www.prefab.com/scripting.html
The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com
Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes
_______________________________________________
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