Re: NSButton setKeyEquivalent doesn't seem to work
Re: NSButton setKeyEquivalent doesn't seem to work
- Subject: Re: NSButton setKeyEquivalent doesn't seem to work
- From: Matt Neuburg <email@hidden>
- Date: Wed, 16 Jul 2008 15:01:01 -0700
- Thread-topic: NSButton setKeyEquivalent doesn't seem to work
On Wed, 16 Jul 2008 17:12:31 -0400, Brian Hughes <email@hidden>
said:
>
>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.
One thing that instantly comes to mind is that a forward slash is not a
backward slash. m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
One of the 2007 MacTech Top 25: <http://tinyurl.com/2rh4pf>
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
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