Thanks for the responses. I had used KVO on the bound property on an earlier version and was encountering a small problem due to the nature of my application. There might be cleaner way so some more details might be helpful.
I'm writing an application that connects to my home theater receiver on its telnet port to remote control and monitor it. The model represents the state of the receiver and can be updated in three ways: 1. Through bindings to the application UI controls. 2. From events sent by the receiver as a response to commands sent by my app. 3. From events sent by the receiver due to other interactions with the receiver (IR remote, front panel, embedded web server). Two and three appear identical to my app but I can figure out case 2 by using the event handler's change dictionary's NSKeyValueChangeOldKey and NSKeyValueChangeNewKey values. I need to know if the model was updated by the UI or by networking code so that I only send command to the receiver in response to UI changes, not other interactions with the receiver. For example, the problem is the observer would see the model "mute" value change to "on" when I changed it at the receiver and interprets that as a change on the app UI. It would then send a redundant "mute on" command to the receiver. Using target-action with bindings solved the problem nicely with a minimum of extra code. If I fail to verify that a race condition doesn't exist I can fall back to reading the values from the action's sender parameter instead of the bound model. Jeff On Wed, Apr 15, 2009 at 11:26 PM, Kyle Sluder <[email protected]> wrote: > On Wed, Apr 15, 2009 at 3:04 PM, Jeff Hutchison > <[email protected]> wrote: >> I am relying on the binding messages to complete before the >> target-action message - is this an OK idea? > > Why not just register as an observer of the bound property? > > --Kyle Sluder > _______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
