• 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: How to control the commit of text edit field with binding?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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: Sat, 6 May 2006 19:55:03 -0400

At 4:11 PM -0700 5/6/06, Jordan Krushen wrote:
>On 5/6/06, James Bucanek <email@hidden> wrote:
>
>> 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.
>
>Isn't that exactly what NSUserDefaultsController's
>-setAppliesImmediately:, -hasUnappliedChanges, -revert, -save etc. do?
>

Sort of, but not really.

The problem is that there is a single shared NSUserDefaultsController and
so those methods' actions are all or nothing.

I have a preferences window with multiple prefs panes and
FactorySettings/Cancel/Save buttons.  Sending revertToInitialValues should
be tied to my FactorySettings button.  But it sets the factory settings for
ALL of the prefs panes at once.  I need it to work for one panel at a time.

In my circumstance similar to the OP's I have a pref panel with a UI
similar to the Network control panel.  It's a Master-detail UI with an Edit
button that allows the user to open a sheet for creating/renaming/deleting
the groups that are viewed in the Master-detail UI.  There are OK/Cancel
buttons in the sheet.  The model is a dictionary in the user defaults and
it's controlled by the shared NSUserDefaultsController.  In essence  I have
an OK button in the sheet and a Save button in the Prefs window, both of
which serve as gateways controlling whether the user's edits are committed.
I don't see how NSUserDefaultsController can control this for me.

-save and -revert both seem to work as advertised.  -hasUnappliedChanges
seems to be useless.  Calling it right after calling -save returns YES, and
there are other complications with it.


--
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

References: 
 >Re: How to control the commit of text edit field with binding? (From: Dustin Voss <email@hidden>)
 >Re: How to control the commit of text edit field with binding? (From: "Jordan Krushen" <email@hidden>)

  • Prev by Date: Re: How to control the commit of text edit field with binding?
  • Next by Date: Re: How to control the commit of text edit field with binding?
  • Previous by thread: Re: How to control the commit of text edit field with binding?
  • Next by thread: NSImageView's valuePath/valueURL bindings read-only but sending NSImage data?
  • Index(es):
    • Date
    • Thread