escape key

Post Reply
User avatar
Greg Gammon
Posts: 105
Joined: Fri Jun 09, 2006 3:27 pm
Location: Bryan, Texas

escape key

Post by Greg Gammon »

I need a code example of how to detect use of the escape key to close a window/dialog. I either need to be able to disable the escape key, or need to perform an action when escape is pressed (same action as exit key on my dialogs) which will release a logical lock.

Thanks in advance (again and again)
G
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

To prevent the user from exiting by using the Esc key:

ACTIVATE DIALOG oDlg;
VALID !GETKEYSTATE( VK_ESCAPE )


Or something like this:

By having a variable like :
local lClose := .F.

DEFINE DIALOG.....
DEFINE BUTTON..........ACTION (Any_Action(), lClose := .T., oDlg:End())

Some more code here.................

ACTIVATE DIALOG..... VALID lClose

If you do not do lClose := .T. you can never close the dialog the normal way. oDlg:End() when lClose == .F. does nothing.
Post Reply