Welcome! Log In Create A New Profile

Advanced

Using ESC Key to exit Window

Posted by Prolay Sarkar 
Prolay Sarkar
Using ESC Key to exit Window
January 29, 2009 06:14PM
Hi,

I am making a form with the following design
________________________________
|
Primary Key Panel | -----------> Primary Edit Fields
________________________________|
|
|
Secondary Block | -----------> Data Fetched On Primary Key
|
|
________________________________|

Now when i should press an Esc key in the secondary block it should take me back to the primary key block and if i press a Esc key in the primary key block the window should get closed. My previous application had this facility so i am trying to give the same facility to the new application. Any idea how this can be done.
Paulo Oliveira
Re: Using ESC Key to exit Window
January 29, 2009 06:49PM
You can do it with several solutions.
In the key down of the controls test if the key pressed is ESC, if the control is on the secondary block use returntocapture to the control in the primary block if the control is on the primary block use close, this is the manual way.

You can use trap the windows events (for WM_KEYDOWN) in every control of your windows (check the help for event) and make one generic procedure to do what ever you want, this is an automatic way but the code of the procedure must be generic.
Fabrice Harari
Re: Using ESC Key to exit Window
January 29, 2009 07:08PM
Hi Prolay...

An easy way to do what you want is to add a button with the ESC key as shortcut... Set it as visible, but on the left side of the window, and therefore active but not visible for the user...

Then in it's code, use the previousField command, you'll get the name of the control that WAs active, and based on that, you can do a returntocapture to the main part, or just a close of the window

best regards

Prolay Sarkar
Re: Using ESC Key to exit Window
January 29, 2009 10:01PM
Hi..


Thanks a lot. It served my purpose.

Regards,
Prolay
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: