Mac OS X Reference Library Apple Developer
Search

Making a Button the Default Button

If button has the NSRoundedBezelStyle bezel type, you can mark it as the default button. A default button pulses, and its action message is invoked when the user presses Return. It looks like this:

Default button

To mark a button as the default, set its key equivalent to Return with setKeyEquivalent:, like this:

[myButton setKeyEquivalent:@"\r"];

You can also set the button’s key equivalent in Interface Builder, as described in “Setting a Button’s Key Equivalent.”

The default button has a thick outline drawn around it, outside the button’s border; your interface design should account for that extra space.




Last updated: 2008-10-15

Did this document help you? Yes It's good, but... Not helpful...