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: Brian Stern <email@hidden>
- Date: Fri, 5 May 2006 16:24:45 -0400
At 8:25 AM -0700 5/5/06, James Bucanek wrote:
>I have a NSUserDefaults string property (the name the user is registed
>as). This is displayed in four places and edited in two. Simple, right?
>Just create a binding in all four places to the defaults controller and
>I'm done.
>
>However, one of the places that the name is editable is in a modal sheet
>where the user can edit several properties then click on OK or Cancel. If
>I bind that text field to the defaults controller, edits to the name are
>commmited immediately. I don't want the changes to the field to be
>propogated until the user clicks the Save button, and ignored if they
>click Cancel.
The way I've dealt with this is to:
Save the value of the field before showing the sheet
If the user clicks Save do nothing (it's already saved)
If the user clicks Cancel: restore the value in the user defaults
controller with the saved value.
You might imagine doing it the other way around but I don't know how to
intercept the editing that is committed through the bindings.
Are you settingAppliesImmediately to NO? You might be able to use the
various methods that are enabled with that setting to control this.
--
Brian Stern
email@hidden
_______________________________________________
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