>In my app I would like my users to be able to hit the ESC key to Release the Active object no matter what it is, a form, print preview, etc, and have the previously Active object become Active.
>
>I know there must be a standard routine to do this. How do I determine what is the currently Active object and should I run the Destroy or Release method to Deactivate the object?
>
>Thank you in advance.
On your forms, you need a command button with the Cancel property set to true. I have one as a base class with the cancel prop set to true and ThisForm.lCanceled = .T. and ThisForm.QueryUnload() in the Click method. My form's QueryUnload() calls a This[Form].UpdateTables or This[Form].RevertTables depending on the value of ThisForm.lCanceled, before doing a This.Release()
In my base form class, I have the following in the Activate:
with This
if .WindowState = 1
.WindowState = 0
endif
.AddActivate()
.Refresh()
endwith
Keep in mind this is NOT Lotus Notes, so Escape may not work the same for all objects that are not forms.
Mark McCasland
Midlothian, TX USA