Re: How to force validation of a NSTextField?
Re: How to force validation of a NSTextField?
- Subject: Re: How to force validation of a NSTextField?
- From: Thomas Lachand-Robert <email@hidden>
- Date: Sat, 16 Mar 2002 22:56:31 +0100
Le samedi 16 mars 2002, ` 10:01 , Bill Cheeseman a icrit :
I have an app with several TextFields,
and a "Run" button. Clicking the latter should validate whichever text
field is currently edited (if any) and then do domething.
The standard way to do this is to make the window first responder.
Something
like this:
[[self window] makeFirstResponder:[self window]];
Making the window first responder makes whoever is currently first
responder
resign, which forces validation. You don't have to know who is first
responder to do this. Leaving the window as first responder afterwards is
harmless.
Thanks a lot for your answer. This actually works, though I feel it not
prefect: the currently selected field is deselected, and in particular the
position of the insertion point is lost (so it's not SO harmless ;-).
So if anyone know about a better way (validating just the content of the
field, not changing its editing state), I'm still interested.
Thomas Lachand-Robert
********************** email@hidden
<< Et le chemin est long du projet ` la chose. >> Molihre, Tartuffe.
_______________________________________________
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.