Solved

Capture Enter Key in Editbox to close modal form

Posted on 2007-11-14
3
990 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
  • 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

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

895 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

11 Experts available now in Live!

Get 1:1 Help Now