Re: Doc-based app, text fields, and losing focus
Re: Doc-based app, text fields, and losing focus
- Subject: Re: Doc-based app, text fields, and losing focus
- From: Matthew Cox <email@hidden>
- Date: Tue, 25 Nov 2003 17:24:22 -0500
On Tuesday, November 25, 2003, at 02:10 PM, James Mcconnell wrote:
Hi all. I have a doc-based app. On this I have several text fields.
What I would like to do is to monitor when focus is lost on a text
field, I want to check to see if the field is empty. If so, I want a
dialog to prompt the user to enter a value. Basically, I want to make
sure every field is filled in.
I know I can use notifications and NSAlert and all of that, but I
don't know how to catch it when focus moves to another text field. I
have 5 NSTextFields, and 2 NSTextViews.
So, how would I go about catching focus lost on a text field? Just a
push in the right direction is all I ask. If anyone knows of any
tutorials, that would be cool too.
The way you're probably looking for is to listen for
textDidFinishEditing:(NSNotification *)note at which point you can do
your validation. IMHO, the better way of doing this is to create a
subclass of NSFormatter to handle your needs. Whatever works.
James
_______________________________________________
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.
_______________________________________________
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.