Re: How to cancel a view-initiated update (model vs view out of sync)
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