Solved

How do you check keystrokes?

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

760 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

19 Experts available now in Live!

Get 1:1 Help Now