Trapping ESCAPE in dBase

Trapping ESCAPE in dBase

Post by Tony Hamilt » Sun, 12 Sep 1993 07:42:03



Am using dBase v1.1 for Unix, but believe this may still be a problem in
all versions, including 2.0 for DOS. I _need_ to trap escapes while in a
READ or EDIT. If you read the manual on ON ESCAPE, it specifically states
that this does not work in READs. Looking through Borland's TechFax on this
subject, they maintain that this is a valuable _feature_, since of _course_
you wouldn't want to disable the functionality of escape. The article
discusses how to trap things like PG-DOWN and so forth in READs, but
basically infers that ESCAPE will always break out of a READ without saving
the changes in the current record.

I've tried playing with SET ESCAPE ON, SET ESCAPE OFF, and a number of
other things. Why do I want to do this? Because, when the user hits ESC while
in a form, I want to _warn_ them that their changes will be lost, and give
them the option of escaping. DOS users may not appreciate this, but in Unix,
everyone is used to using the ESC key in the vi editor to be able to save
their document. I have a large body of Unix users who are instinctively
hitting ESC after they are done editing a form, only to find all their
changes lost.

Thanks in advance for any help.

Tony Hamilton

 
 
 

Trapping ESCAPE in dBase

Post by Doug » Mon, 13 Sep 1993 12:51:35



>Am using dBase v1.1 for Unix, but believe this may still be a problem in
>all versions, including 2.0 for DOS. I _need_ to trap escapes while in a
>READ or EDIT. If you read the manual on ON ESCAPE, it specifically states
>that this does not work in READs. Looking through Borland's TechFax on this
>subject, they maintain that this is a valuable _feature_, since of _course_
>you wouldn't want to disable the functionality of escape. The article
>discusses how to trap things like PG-DOWN and so forth in READs, but
>basically infers that ESCAPE will always break out of a READ without saving
>the changes in the current record.

>I've tried playing with SET ESCAPE ON, SET ESCAPE OFF, and a number of
>other things. Why do I want to do this? Because, when the user hits ESC while
>in a form, I want to _warn_ them that their changes will be lost, and give
>them the option of escaping. DOS users may not appreciate this, but in Unix,
>everyone is used to using the ESC key in the vi editor to be able to save
>their document. I have a large body of Unix users who are instinctively
>hitting ESC after they are done editing a form, only to find all their
>changes lost.

>Thanks in advance for any help.

>Tony Hamilton


I use the function LASTKEY() to trap the ESCAPE key and many other keyboards
combination after the READ command.  Here is an example, with the ESC key
being the ASCII number of 27:

READ
if lastkey() = 27
    do got_esc
endif

 
 
 

1. Help: Trapping the ESCAPE key

I've 'inherited' a foxpro project. Unfortunately it has this irritating bug.
The original programmer uses CASE and test for the last key pressed. After
the supervisor option is chosen the program goes on to prompt for a password
ONLY if the enter key or click is pressed. The problem is :this simple password
routine is completely bypassed when the ESCAPE key is pressed!

I SET ESCAPE ON and tried trapping the ESCAPE key by testing for its
matching code, by using ON ESCAPE DO... to no avail.

Any ideas? Anything which I might have overlooked? Grateful for whatever
comments that might give me a clue to carry on...

2. How to get ODBC driver of Sybase 11 for Windows NT

3. Trapping the escape key

4. Using Char() function

5. How to fix DBASE IV Escape Key Problem?

6. database and .exe Package question

7. File trapping in Dbase 3 +

8. SQL Server Vs SQL Anywhere

9. problem with error trap in dBase IV v1.1

10. HELP:Dbase file error trapping.

11. ON ESCAPE versus ON KEY LABEL ESCAPE

12. Error Trapping - Can you trap a DTS Package error using SQLDMO running a job

13. Error Trapping: MS Access errors not trapped in VB code