There are many ways to do this.
1. Define 'ON KEY ESCAPE' function (SET ESCAPE should be OFF for this). For example,
ON KEY ESCAPE _screen.Activeform.Release
2. When all of these forms have 'close' buttons, assign .T. to 'Cancel' property of button. When users press ESC for such form, 'Cancel' button Click event will be fired.
3. Define base class for all these forms, assign .T. to 'KeyPreview' property and write code in KeyPress event to close form when ESC key (code 27) pressed.
Any of above ways may cause 'unwritten changes in control' problem - when user typed something, than press ESC - in some cases VFP do not apply value property of control to the bound control source. So, get active control and simple command 'm.loActiveControl.Value = m.loActiveControl.Value' fixes this.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.