• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Changing default button cell in Cocoa Application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Changing default button cell in Cocoa Application


  • Subject: Changing default button cell in Cocoa Application
  • From: Kerms Technical Services <email@hidden>
  • Date: Tue, 21 Jul 2009 10:43:51 -0500

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


  • Follow-Ups:
    • Re: Changing default button cell in Cocoa Application
      • From: Dave Fernandes <email@hidden>
    • Re: Changing default button cell in Cocoa Application
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: Apple's Reducer Example
  • Next by Date: Re: Recording phone calls
  • Previous by thread: Apple's Reducer Example
  • Next by thread: Re: Changing default button cell in Cocoa Application
  • Index(es):
    • Date
    • Thread