*----------------------------------------------------------- *-- Allow the form to be released when user hits Escape, if *-- lReleaseOnESC is .T. *----------------------------------------------------------- LPARAMETERS nKeyCode, nShiftAltCtrl IF this.lReleaseOnESC AND nKeyCode = KEY_ESCAPE nodefault IF this.QueryUnload() IF This.WindowType = WIN_MODAL This.Hide() ELSE This.Release() ENDIF ENDIF ENDIFI added nodefault, but it didn't help. In QueryUnload there is a method called WriteBuffer. This method checks type('_screen.ActiveForm.ActiveControl') and then executes valid of this control, if it's an object. However, in case of ESC the above test doesn't evaluate to O.