On Jul 11, 2013, at 11:23 , Matthew LeRoy <mle...@minitab.com> wrote:

> I had previously considered the same approach you suggested regarding adding 
> to the checkbox's action method. The problem is that our desired behavior is 
> to allow the checkbox to be unchecked at any time, and any uncommitted edits 
> simply be discarded whether they are valid or not.


Relying on the text field delegate methods to capture the change of state in 
every sequence of events seems fragile.

You should probably approach this by having your checkbox action method adjust 
the value of the text field directly, just after disabling it. Either set the 
text field to "not available" when disabling, or validate the input and discard 
invalid values.

You might additionally choose to re-validate the text field value later, when 
it's actually used (or committed to your data model). That way, if there's a 
scenario you've overlooked that would leave invalid input in the field, it 
can't propagate to the data model.

Incidentally, I'd suggest that the reason you're running into an issue is that 
you "really" have a composite control, but you're "simulating" it via a pair of 
separate controls. It's not very surprising in that case that you might have to 
code the relationship between the controls explicitly.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to