Solved

Capture Enter Key in Editbox to close modal form

Posted on 2007-11-14
3
999 Views
Last Modified: 2012-06-27
I have a form that prompts for a password using an editbox on a modal form. The OK and Cancel buttons work fine to close the form and either continue or abort. I want to capture the Enter and Esc keys in the edit box to simulate the OK click and the Cancel click. I have put code in the keypress event. It calls the click event for the buttons, but then just sits there.
0
Comment
Question by:SantaRosa
[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
  • 2
3 Comments
 
LVL 13

Accepted Solution

by:
rfwoolf earned 500 total points
ID: 20279253
Use the keyeevent to set the modal result of your form to something other than 0, e.g.
form2.ModalResult := 1;
0
 
LVL 13

Assisted Solution

by:rfwoolf
rfwoolf earned 500 total points
ID: 20279267
I have a feeling that what you were doing wrong was you were calling the button's onclick event, e.g.
button1.OnClick(self);
instead of
button1.click;

OR... the other way round.

But I could be wrong... :P
0
 

Author Comment

by:SantaRosa
ID: 20279336
I had submitted the question. Both solutions work easily. Turn around time was terrific. Thankyou.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying 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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

705 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