Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Capture Enter Key in Editbox to close modal form

Posted on 2007-11-14
3
Medium Priority
?
1,003 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 2000 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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…
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

597 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