How to press a button with the enter key

10,610

Set the button's Default property to True from Object Inspector.

Share:
10,610

Related videos on Youtube

J Bom
Author by

J Bom

Updated on April 01, 2020

Comments

  • J Bom
    J Bom about 4 years

    I have simple question. How do you press a button with your enter key?

    I have a login screen, where I can just login with a button. But I also want to login when pressing the enter button.

    How should I do this?

    Thanks in advance!

    Jasper

    • Andreas Rejbrand
      Andreas Rejbrand about 13 years
      You should also know that the Cancel property will make the button respond to the Escape key. In a dialog box with one OK button and one Cancel button, you most often set the OK button to Default := true and the Cancel button to Cancel := true. In addition, the modal results should be ModalResult := mrOK and ModalResult := mrCancel, respectively.
  • J Bom
    J Bom about 13 years
    Where can I do that? Cause I have no idea?
  • Cosmin Prund
    Cosmin Prund about 13 years
    You select the button you want activated with the Enter key (probably an Ok or LogIn button), you go to your Object Inspector, find the Default property and select True.