WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Dialog Editor version 6.X
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Disable Using ESC Key to Close Dialogs


Question:

I was wondering if anybody might be able to help me resolve this question.

I have noticed that when I write a script using a dialog I can sometimes use the Escape Key to close the dialog and the program exits.

Most of my dialogs have simple data entry fields, an ADD button (default button) and a CANCEL button. The users fill in the fields and hit Enter. The dialog is then ready for more input until they hit CANCEL, or the Escape Key at which point it finishes the program.

The problem is that this Escape Key facility is available 'sometimes' and I would like to know how to turn this facility on.

I am using the current version of the compiler, I do not do any special coding to cater for the Escape Key, and I do not use User defined Dialog procedures in these simple scripts. Sometimes it's available, sometimes it's not and I don't know what switches it on.

Any hints or idea's on how to control it would be greatly appreciated.

Answer:

The important thing here is the value in the field after the "Cancel" title, the title is not important. If the value is zero then pressing the Escape key or clicking it causes the dialog to exit to a :CANCEL label in the calling script.

If there is no Cancel label the script just terminates.

myFormat=`WWWDLGED,6.1`

myCaption=`Never Cancel`
myX=002
myY=033
myWidth=134
myHeight=066
myNumControls=003
myProcedure=`DEFAULT`
myFont=`DEFAULT`
myTextColor=`DEFAULT`
myBackground=`DEFAULT,DEFAULT`
myConfig=0

my001=`009,039,036,012,PUSHBUTTON,DEFAULT,"OK",1,1,32,DEFAULT,DEFAULT,DEFAULT`
my002=`083,039,036,012,PUSHBUTTON,DEFAULT,"Cancel",0,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
my003=`009,009,110,012,EDITBOX,MyVariable1,"Edit 1",DEFAULT,3,DEFAULT,DEFAULT,DEFAULT,DEFAULT`

:CANCEL
ButtonPushed=Dialog("my")

Display(2, 'Ok', 'Bye now.')
Exit

Article ID:   W16919
File Created: 2007:07:03:14:27:04
Last Updated: 2007:07:03:14:27:04