Re: NSSecureTextField
Re: NSSecureTextField
- Subject: Re: NSSecureTextField
- From: j o a r <email@hidden>
- Date: Thu, 30 Oct 2003 08:16:43 +0100
On 2003-10-30, at 07.14, Sean Liong wrote:
[passwordField setStringValue: [NSString stringWithFormat:@"" ]];
No, don't do it this way! If you need to create an empty string, and a
constant string isn't good enough for some reason, you would do it like
this (most often used for mutable strings, as it's pretty pointless for
immutable strings):
NSString *str = [NSString string];
I'm not advocating in in this case though, as the original code snippet
*should* work as is.
To troubleshoot:
Can you *get* the string value from the secure text field? Try this:
NSLog(@"secure text field contents: %@", [passwordField stringValue]);
Does it print what you expect? If not, you might have some problem with
your connection to the secure text field. Perhaps you need to end
editing in the text fields before clearing their values, something like
this:
- (void) endEditing
{
if (![myWindow makeFirstResponder: myWindow])
{
[myWindow endEditingFor: nil];
}
}
- (IBAction) clear:(id) sender
{
[self endEditing];
[mySecureTextField setStringValue: @""];
}
j o a r
_______________________________________________
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.