We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Delphi 7 - How can I make the <enter> key on a button ?

John86a
John86a asked
on
Medium Priority
1,167 Views
Last Modified: 2012-08-14
Basically the button needs to act like enter key on this particular Memo, is that possible?
Comment
Watch Question

Ephraim WangoyaSoftware Engineer
CERTIFIED EXPERT

Commented:
this way
procedure TForm3.Button1Click(Sender: TObject);
begin
  Memo1.SetFocus;
  Keybd_Event(VK_RETURN,   1, 0, 0);
end;

Open in new window

Ephraim WangoyaSoftware Engineer
CERTIFIED EXPERT

Commented:

Modify this to
procedure TForm3.Button1Click(Sender: TObject);
begin
  Memo1.SetFocus;
  Keybd_Event(VK_RETURN, 1, 0, 0);
  Keybd_Event(VK_RETURN, 1, KEYEVENTF_KEYUP, 0);
end;

Open in new window

Software Engineer
CERTIFIED EXPERT
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
That helped me track where my application was replacing <Enter> for <Tab> thank you.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.