Re: Is automatic key-value validation possible?
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