Solved

How do you check keystrokes?

Posted on 1998-12-05
3
543 Views
Last Modified: 2006-11-17
How do you check for keystrokes in an EDIT1.text field?
I want to do something only when the enter key is pressed.
I do not want to always do a routine when i type any key in.
I want to do it only after the Enter key is pressed.

Any idea?
HELP!! :)
0
Comment
Question by:waipahu
3 Comments
 

Accepted Solution

by:
elkiors earned 10 total points
ID: 1349379
In the OnKeyPress event for your edit box add this

If (Key=chr(13)) THEN
BEGIN
  {Do Processing for enter key pressed here}
END;

You can also trap keys by using the onkeydown and onkey up events and use the windows constants to test the key. Have a look at the Windows.pas interface code in the source directory. Here are some windows constants:

VK_RETURN   Enter Key
VK_ESCAPE   Escape Key

Darren


0
 

Expert Comment

by:v_pasupuleti
ID: 1349380
Hi Waipahu,
check if the default property is set to false if you are using a ok bitbutton in the form also set the form key preview property is set to true if you want to do it at a form level.

Vijay
0
 

Author Comment

by:waipahu
ID: 1349381
Thanks so much!
It worked!!!!!!!!!!!!!!!
I really appreciate all your help!!!!!!!!!!!!!!!!
Great!


0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

774 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question