Re: How to control the commit of text edit field with binding?
Re: How to control the commit of text edit field with binding?
- Subject: Re: How to control the commit of text edit field with binding?
- From: James Bucanek <email@hidden>
- Date: Sat, 6 May 2006 15:45:23 -0700
Dustin Voss wrote on Friday, May 5, 2006:
>I handled a situation vaguely like this by treating the window
>controller as a model object. Basically, the window controller copies
>the original settings into local variables, the user sets everything
>he likes, and the window only manually adjusts the real settings only
>when the user presses OK.
That was an idea I was playing around with too, but it seemed liked way too much work for a single value. ;) And it also seemed like such a common use pattern that I would have expected support for it in the NS classes.
On reflection, there might be a generalized solution possible. If I run into this again, I'm going to consider creating a subclass of NSObjectController and adding a transparent/buffered mode to the object. In transparent mode, everything works like a regular NSObjectController; all notifications of value changes are passed to the appripriate reciever. But in buffered mode, changes to values receives from the view would simply be stored in a dictionary and not passed to the model. When the view is ready, all of the buffered changes could be sent to the model en mass or discarded.
With a little more work, the object could also cache the original value of each property allowing it to support Save, Apply, Revert, and Cancel.
If this works, I'll post the code.
James
--
James Bucanek
_______________________________________________
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