FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour escape key
Posts: 105
Joined: Fri Jun 09, 2006 03:27 PM

escape key

Posted: Tue Sep 04, 2007 04:04 PM

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

Regards,

Greg Gammon
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM

escape key

Posted: Tue Sep 04, 2007 05:40 PM

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.

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10

Continue the discussion