• 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: NSTextField: edits are committed even when -control:isValidObject: returns NO
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextField: edits are committed even when -control:isValidObject: returns NO


  • Subject: Re: NSTextField: edits are committed even when -control:isValidObject: returns NO
  • From: Quincey Morris <email@hidden>
  • Date: Thu, 11 Jul 2013 12:14:00 -0700

On Jul 11, 2013, at 11:23 , Matthew LeRoy <email@hidden> 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 (email@hidden)

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: NSTextField: edits are committed even when -control:isValidObject: returns NO
      • From: Matthew LeRoy <email@hidden>
References: 
 >NSTextField: edits are committed even when -control:isValidObject: returns NO (From: Matthew LeRoy <email@hidden>)
 >Re: NSTextField: edits are committed even when -control:isValidObject: returns NO (From: Keary Suska <email@hidden>)
 >Re: NSTextField: edits are committed even when -control:isValidObject: returns NO (From: Matthew LeRoy <email@hidden>)

  • Prev by Date: Re: NSTextField: edits are committed even when -control:isValidObject: returns NO
  • Next by Date: Re: CATiledLayer requesting tiles that are way out of view bounds
  • Previous by thread: Re: NSTextField: edits are committed even when -control:isValidObject: returns NO
  • Next by thread: Re: NSTextField: edits are committed even when -control:isValidObject: returns NO
  • Index(es):
    • Date
    • Thread