Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Close form when user presses Escape key

309 views
Skip to first unread message

Arne Alles

unread,
Sep 1, 1999, 3:00:00 AM9/1/99
to
Hi all,

I would like a subform to be closed
when the user presses the Escape key.
It would be great if someone had a solution
which does not use a "Close" button with
it's Cancel property set to true.

Thanks!

Arne.

Woody

unread,
Sep 1, 1999, 3:00:00 AM9/1/99
to
In the forms OnKeyDown event, test for the escape key, #27, and if so, post
a WM_CLOSE message for the form.

Woody

Arne Alles <al...@hildesheim.sgh-net.de> wrote in message
news:7qj7g1$ck...@forums.borland.com...

James M. Lucas

unread,
Sep 1, 1999, 3:00:00 AM9/1/99
to
You should be able to do it by setting the KeyPreview property to true
and call the release function at OnKeyDown event if Key = VK_ESCAPE.

James

Doug Chamberlin

unread,
Sep 1, 1999, 3:00:00 AM9/1/99
to
On Wed, 1 Sep 1999 13:38:48 +0200, "Arne Alles"
<al...@hildesheim.sgh-net.de> wrote:

>Hi all,
>
>I would like a subform to be closed
>when the user presses the Escape key.
>It would be great if someone had a solution
>which does not use a "Close" button with
>it's Cancel property set to true.

Have the form monitor all keystrokes by setting its KeyPreview
property to True. Then in the OnKeyPress event handler, check if the
key is Escape and call Close if it is.


0 new messages