• 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: Is automatic key-value validation possible?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is automatic key-value validation possible?


  • Subject: Re: Is automatic key-value validation possible?
  • From: Frederick Cheung <email@hidden>
  • Date: Sat, 18 Sep 2004 17:58:22 +0200


On 18 Sep 2004, at 17:55, Christian Gottschall wrote:

Hi,

when I implement a validation method for some property Hugo, is there a way to bind e.g. a NSTextField to that property such that Cocoa itself takes care of validation (by automatically calling validateHug:error:, just like it calls setHugo: for actually setting the value)?

At the current stage of my knowledge, there are only programmatic ways to achieve input validation: (1) I could implement an appropriate NSFormatter for each NSTextField; or (2) I could do validation in the delegate's control:textShouldEndEditing: method. Of course both are possible and fairly easy, but it would seem even more convenient if the NSTextField itself would call the appropriate validation method. If validation fails, it could refuse accepting the input. Can I achieve this with Cocoa bindings alone?

You need to tick the "validates immediately" box when you set the binding in IB.

Fred

_______________________________________________
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:
    • Re: Is automatic key-value validation possible?
      • From: Christian Gottschall <email@hidden>
References: 
 >Is automatic key-value validation possible? (From: Christian Gottschall <email@hidden>)

  • Prev by Date: Is automatic key-value validation possible?
  • Next by Date: Re: Creating popup button's menu at the last moment
  • Previous by thread: Is automatic key-value validation possible?
  • Next by thread: Re: Is automatic key-value validation possible?
  • Index(es):
    • Date
    • Thread