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
escape key
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
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.
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.