Solved

How do you check keystrokes?

Posted on 1998-12-05
3
546 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Printing problem 2 123
Delphi: Connect to running MS Outlook 4 199
How to build JSON File in Delphi 6 3 92
Sending files from  idTcpServer Socket to idTcpClient 2 63
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

739 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