Re: textShouldEndEditing Issues!
Re: textShouldEndEditing Issues!
- Subject: Re: textShouldEndEditing Issues!
- From: Daniel Todd Currie <email@hidden>
- Date: Fri, 12 Dec 2003 15:20:20 -0800
Sounds to me like you'd be better off with an NSFormatter.
On 2003 Dec 12, at 11:05, Huyler, Christopher M wrote:
Perhaps my previous post was not refined enough. I have a preference
pane with several text fields in it. Once the user edits a field, I
want to check the format of it as soon as they try to do something
else,
whether it is quitting the System Preferences App, selecting a
different
Preference Pane, or just changing the current tab of my pane. I am
trying to do this with "- (BOOL)control:(NSControl *)control
textShouldEndEditing:(NSText*)text" but it is not working how I want.
If the function is going to fail I pop up a modal sheet using NSAlert's
beginSheetModalForWindow function.
These are the limitations I am running into:
1) The user edits then enters Cmd-Q to quit. I get the alert sheet the
first time. If the user clicks "OK" then enters Cmd-Q again, it lets
them quit...textShouldEndEditing doesn't get called again.
2) The user attempts to change the current Panel. The following code
works the first time:
- (NSPreferencePaneUnselectReply)shouldUnselect {
return ([[NSApp keyWindow] isSheet]) ? NSUnselectCancel :
NSUnselectNow;
}
But after it runs, my textField looses its first responder status
meaning if the user tries to change the current panel again, it will
work. The invalid entry is left in the textField.
I know there is a work-around because Apple's Network Control Panel
does
it when you try to put in an invalid DNS Server. You cannot do
anything
else until you fix it.
Is there another delegate function I should be implementing? Does this
have anything to do with using the Window's default field editor?
--
Christopher Huyler
Computer Associates Intl.
mailto:email@hidden
_______________________________________________
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.