Hi,
I Have too Enter Button on a form: a TButton and a bitbtn(On delphi) When press the button 'enter' on the keyboard, I get the execution of the second button.How can I correct this bug?
Steph's reply is correct - the button with focus always responds to the Enter key. But if no button has focus, i.e. the focus is on a non-button component such as an edit box, then if one of your buttons has its Default property set to True, it will respond to the Enter key. My guess is your second button is probably the "Default" button - check its properties. You may want to set it to False.
If you always want the first button to respond to the Enter key even if a non-button component has the focus at the time, then set the first button's Default property to True.
Also, for the form there's a property called ActiveControl. In the Object Inspector, set this to the button that you want to be the default; that way, when the form gets shown, that button will have focus.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.