NSButton setKeyEquivalent doesn't seem to work
NSButton setKeyEquivalent doesn't seem to work
- Subject: NSButton setKeyEquivalent doesn't seem to work
- From: Brian Hughes <email@hidden>
- Date: Wed, 16 Jul 2008 17:12:31 -0400
- Importance: Normal
I want the default button to reflect where the user has decided to enter information. I have a sign up / log in page. If the user is new and is signing up I want the signUp button to be the default but if the user is already signed up and elects to use the log in field I want the logIn button to be default.
I have assigned the signIn Button to be the default in Interface Builder by designating the key equivalent to be the return key. When the user elects to log in I want the default button to become the logIn Button. Here is my code:
- (void )controlTextDidBeginEditing: (NSNotification *) aNotification
{
if ([logInNameField isEqual: [aNotification object]])
{
[logInButtonOutlet setKeyEquivalent: @"/r"];
[signUpButtonOutlet setKeyEquivalent: @""];
NSLog (@"The key equivalent for log in Field is: %@", [logInButtonOutlet keyEquivalent]);
NSLog (@"The key equivalent for log in Field is: %@", [signUpButtonOutlet keyEquivalent]);
}
}
The log shows that the key equivalent for the logIn Button is now /r, the login Button highlights blue and the key equivalent for signUpButton is "" but the logIn Button's action is not invoked if the return button is pressed.
Any help would be appreciated.
Thanks in advance,
Brian
_________________________________________________________________
Stay in touch when you're away with Windows Live Messenger.
http://www.windowslive.com/messenger/overview.html?ocid=TXT_TAGLM_WL_messenger2_072008_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden