You can specify that a CommandButton is the default button in a window by selecting Default in the General property page in the button's Properties view.
When there is a default CommandButton and the user presses the Enter key:
If the focus is not on another CommandButton, the default button's Clicked event is triggered
If the focus is on another CommandButton, the Clicked event of the button with focus is triggered
Other controls affect default behavior If the window does not contain an editable field, use the SetFocus function or the tab order setting to make sure the default button behaves as described above.
A bold border is placed around the default CommandButton (or the button with focus if the user explicitly tabs to a CommandButton).
You can define a CommandButton as being the cancel button by selecting Cancel in the General property page in the button's Properties view. If you define a cancel CommandButton, the cancel button’s Clicked event is triggered when the user presses the Esc key.