I have a dialog with 1 or more buttons and want to be able to programmatically set the rightmost one be the default one, so that when the user presses the Enter or Return key it
[myWindow setDefaultButtonCell:[btn cell]]; // should do the trick.
See Apple's documentation for more details.