Rob -
 
I don't believe you can prevent a user from pressing ESC to exit a form, so you have to do something else.
 
Here's what I do -
 
I set up the DONE button to execute Button.EEP USING 1
I set up the CANCEL button to execute Button.EEP USING 99
 
-- Button.EEP
SET VAR fButton = .%1
IF fButton = 1 THEN  --User clicked on DONE so it will save the record
  SET VAR fFormDirty = 'N'
  IF (ISTAT('FORM_DIRTY_FLAG')) = 1 THEN
    SET VAR fFormDirty = 'Y'
    SAVEROW
  ENDIF
ENDIF
CLS
CLOSEWINDOW
RETURN
 
If the user clicks the Done button, then the value of fButton is "1" otherwise, if they click Cancel or press the ESC, it remains "0".
 
 
SET VAR fButton INTEGER = 0
EDIT USING formname WHERE yada yada
IF fButton = 0 THEN    --User Pressed ESC
  run some dialog or something to confirm whether or not they wanted to cancel or continue
  IF they want to cancel THEN
    SET VAR fButton = 99
  ELSE
    SET VAR fButton = 1
ENDIF
IF fButton = 99 THEN
  run your cancel routine
ENDIF
IF fButton = 1 THEN
  run your "done" command file
ENDIF
 
Sami
 
-----------------------------------------------------------
Sami Aaron
Software Management Specialists
19312 W 63rd Terr
Shawnee KS  66218
913-915-1971
http://www.softwaremgmt.com
----- Original Message -----
Sent: Wednesday, September 04, 2002 6:55 PM
Subject: Disable [Esc] on Forms

Greetings Guru's
 
In order to correctly process a form, I need to force the user to click a button and confirm
that they are [Done] or that they want to [Cancel].
 
When clicked, each button has a very specific .eep that runs to perform various calculations.
 
I'm finding that the form can be exited by pressing the [Esc] key which by-passes the routines
I've written and popups the generic dialog for Save, Discard or Cancel giving the user a false
impresion that things are as they should be (Not!).
 
Any way to disable the [Esc] from exiting a form?
I've toyed around with SET KEYMAP, but [Esc] doesn't appear to be a valid key.
 
Are there any inherent problems with attempting this, or is there a better to go about it?
 
As always, I appreciate everyone's input.
 
- Rob Vincent
Dearborn Heights, Michigan

Reply via email to