• 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 cancel a view-initiated update (model vs view out of sync)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to cancel a view-initiated update (model vs view out of sync)


  • Subject: Re: How to cancel a view-initiated update (model vs view out of sync)
  • From: Ondra Cada <email@hidden>
  • Date: Fri, 28 Apr 2006 15:09:18 +0200

Mark,

On 28.4.2006, at 10:50, Mark Munte wrote:

Now, when the user presses the checkbox, my model is getting the message and atempting to enable the requested feature (in my case, configuring a sequence grabber video channel), BUT, the request might fail, in wich case I neeed to cancel the update.

The problem here, is that in the end, the view (GUI) and the model are out of sync since the view does not get informed that the requested model update was canceled/failed: on the view, the the checkbox appears checked, but the model has the value set to FALSE.

How can I force the view to refresh?

There are ways, but it would still be wrong.

Effectively (by "failing the request and returning to the original value") you are validating. The documentation makes a point of emphasizing you should never ever validate in accessors :)

Set the value *always* in the accessor, and use validation later to return to the original value if it proves (in the current conditions) impossible.
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc



_______________________________________________ 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: 
 >How to cancel a view-initiated update (model vs view out of sync) (From: Mark Munte <email@hidden>)

  • Prev by Date: Re: Converting C strings into NSStrings (and vice versa)
  • Next by Date: Re: First day of the week? Which one?
  • Previous by thread: How to cancel a view-initiated update (model vs view out of sync)
  • Next by thread: How to receive the events across the applications
  • Index(es):
    • Date
    • Thread