• 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: Cocoa bindings one- or bi-directional
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa bindings one- or bi-directional


  • Subject: Re: Cocoa bindings one- or bi-directional
  • From: Jonathon Mah <email@hidden>
  • Date: Sat, 28 May 2005 01:40:18 +0930

Hi Tim,

On 2005-05-27, at 23:35, Tim Lucas wrote:

Always, always use a controller.

Controllers implement the NSEditor/NSEditorRegistration protocols. That means that they correctly handle the cases when documents revert, or save, and forward the correct notifications to the model/view items when that happens. This way models get any uncommitted edits, and can handle them appropriately.

I still don't understand the problem they solve. Maybe an example?

I'll have to contrive it a little, but hopefully you can still see the advantage.


Say you have an app that does some calculations based on some values in text fields. These calculations take a few seconds. When a user goes into a field, changes the value, and commits editing (by hitting return, tabbing out, or clicking somewhere else) the rest of the document recalculates.

The user is in one of the text fields and has typed a value, but hasn't committed editing in any way. She hits Cmd-S. What should happen here is that the value be committed, the document recalculated, and finally saved, with the focus remaining in the text field. NSController and friends takes care of this committing.

Now again, the user is in another text field and has typed a value, but hasn't committed. She then decides to revert the document or quit the app. Here the editing should be discarded immediately with no recalculation (as it takes time, and the results would just be thrown out anyway). Again, NSController takes care of this situation.


If there are any inaccuracies, please correct them!

Hope this helps,


Jonathon Mah email@hidden


Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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

  • Follow-Ups:
    • Why use a NSController (was Re: Cocoa bindings one- or bi-directional)
      • From: Tim Lucas <email@hidden>
References: 
 >Cocoa bindings one- or bi-directional (From: Zdzislaw Losvik <email@hidden>)
 >Re: Cocoa bindings one- or bi-directional (From: Kay Roepke <email@hidden>)
 >Re: Cocoa bindings one- or bi-directional (From: mmalcolm crawford <email@hidden>)
 >Re: Cocoa bindings one- or bi-directional (From: mmalcolm crawford <email@hidden>)
 >Re: Cocoa bindings one- or bi-directional (From: Scott Anguish <email@hidden>)
 >Re: Cocoa bindings one- or bi-directional (From: mmalcolm crawford <email@hidden>)
 >Re: Cocoa bindings one- or bi-directional (From: Scott Anguish <email@hidden>)
 >Re: Cocoa bindings one- or bi-directional (From: Tim Lucas <email@hidden>)
 >Re: Cocoa bindings one- or bi-directional (From: Tim Lucas <email@hidden>)

  • Prev by Date: Nimoy S Johnson is out of the office.
  • Next by Date: Re: NSScrollView problems in Tiger
  • Previous by thread: Re: Cocoa bindings one- or bi-directional
  • Next by thread: Why use a NSController (was Re: Cocoa bindings one- or bi-directional)
  • Index(es):
    • Date
    • Thread