Re: Validating NSControl
Re: Validating NSControl
- Subject: Re: Validating NSControl
- From: Matt Neuburg <email@hidden>
- Date: Wed, 11 Sep 2002 08:31:35 -0700
On Tue, 10 Sep 2002 21:20:53 -0700, Dietrich Epp <email@hidden> said:
>
All right... I got a NSControl to validate its input, but I can still
>
press the OK button in my dialog even when I enter fotzed text into the
>
control (specifically a NSForm tied to a NSNumberFormatter).
The typical approach is that the OK button action should start by trying to
set the window's firstResponder to the window itself. That returns a
boolean. If the control's contents are invalid it will refuse to surrender
firstResponder status, the computer will beep, the button action will get a
NO and return, and all will be well. m.
--
matt neuburg, phd = email@hidden,
http://www.tidbits.com/matt
pantes anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart.
http://www.tidbits.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.