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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to