selectText field in case of Return key
selectText field in case of Return key
- Subject: selectText field in case of Return key
- From: Lorenzo <email@hidden>
- Date: Thu, 17 Apr 2003 12:59:27 +0200
Hi,
I have 3 NSTextFields on my window,
and I want that if the user forgot to fill one, I advise him,
and I select the empty field. Now, the following code works only
if the user clicks on the button OK in the dialog, but if he presses the
RETURN key in order to execute the same procedure, the current field remains
selected.
if([[address stringValue] isEqualToString:@""]){
NSRunAlertPanel(@"Warning:", @"Please specify a valid address.",
@"OK", nil, nil);
//[theWindow endEditingFor:nil]; I tried this too
[address selectText:nil];
return NO;
}
The window is modal
session = [NSApp beginModalSessionForWindow: theWindow ];
and the button OK is a simple NSButton (push)
So, how to select the field "address" even if the user presses the RETURN
key?
Best Regards
--
Lorenzo
email: 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.