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
The documentation says:
Note that if you set the key equivalent to Return, that button becomes the default button.
Thus, you're doing it correctly. You could try this after setting the key equivalent:
[button setNeedsDisplay:YES];
This forces the button to redraw itself.