NSButton default button with blueish look

后端 未结 5 861
感情败类
感情败类 2021-02-03 23:36

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

5条回答
  •  迷失自我
    2021-02-03 23:54

    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.

提交回复
热议问题