Solved

How do you check keystrokes?

Posted on 1998-12-05
3
542 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

864 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now