Re: Changing default button cell in Cocoa Application
Re: Changing default button cell in Cocoa Application
- Subject: Re: Changing default button cell in Cocoa Application
- From: Dave Fernandes <email@hidden>
- Date: Wed, 22 Jul 2009 09:05:47 -0400
You can make this change without using setDefaultButtonCell at all.
Just make sure you change btnEnter's key equivalent to be something
other than <return> before changing btnBuild's to be <return>.
[btnEnter setKeyEquivalent:@""];
[btnBuild setKeyEquivalent:@"\r"];
On Jul 21, 2009, at 11:43 AM, Kerms Technical Services wrote:
I have a window "winUser" with two buttons "bntEnter" and
"bntBuild". I am trying to switch the "default button" between the
two as the program progresses.
Initially both buttons are disabled. After the user enters some text
fields I set "bntEnter" as the default with
[winUser setDefaultButtonCell:[btnEnter cell]];
which works fine. The button highlights and acts on Return key.
In the "Enter" handler I attempt to switch to "bntBuild" as the
default button cell using:
[winUser setDefaultButtonCell:[btnBuild cell]];
The "Build" button highlights but when I press "Return" key the
"Enter" button flashes and the Enter handler is called, NOT the
"Build" handler.
I put in debug code to query and log the winUser's default button
cell at IT reports the (desired) values of "btnEnter" and "btnBuild"
respectively. It seems that once the default is set it cannot be
changed.
I am developing with XCode 3.1.2 in Leopard but targeting to 10.4.
I have tried disabling and enabling the default button cell as part
of the process, and using "setKeyEquivalent" but always get the same
result.
Is there more to switching the default button cell than
"setDefaultButton"?
Help greatly appreciated.
_______________________________________________
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
_______________________________________________
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