>Hi everybody,
>
>In MereMortals framework we can close form by pressing ESC. I noticed, that if I type something in the textbox control, then click on Close button at the upper right corner, I'm asked a question: "Do you want to save your changes?". If I type something and press ESC, the question is not asked and form simply closes and that I typed is lost.
>
>Here is Baseform KeyPress method:
>
>
>*-----------------------------------------------------------
>*-- 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
>ENDIF
>
>
>I 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.
>
>The solution could be having form's property oLastActiveControl and binding object's GotFocus method and changing that property, but it's a little bit cumbersome. Do you see a simpler way to fix this annoying problem?
>
>Thanks a lot in advance.
Move the code into Form.Release
DO CASE
CASE !this.QueryUnload()
nodefault
CASE This.WindowType = WIN_MODAL
This.Hide()
OTHERWISE
ENDCASE