escape key

escape key

Postby Greg Gammon » Tue Sep 04, 2007 4: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
User avatar
Greg Gammon
 
Posts: 105
Joined: Fri Jun 09, 2006 3:27 pm
Location: Bryan, Texas

Postby James Bott » Tue Sep 04, 2007 5: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.
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 97 guests