Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Willson de Veas
  Where is Willson de Veas?
 Redding
 California - United States
 Willson de Veas
 To: FoxGuy Ruiz
  Where is FoxGuy Ruiz?
 hawthorne
 California - United States
 FoxGuy Ruiz
 Tags
Subject: RE: Assingning a key to close a form
Thread ID: 143671 Message ID: 143695 # Views: 3 # Ratings: 0
Version: Visual FoxPro 9 Category: General VFP Topics
Date: Friday, August 31, 2007 12:44:10 AM         
   


> How can i assign the escape key of the keyboard [Esc] to close a form.

I've personally used, and would recommend, Borislav's second suggestion. Since you want to use Esc to close the form, you can forgo coding for a KeyPress event and instead design your forms with a CommandButton that has code to release the form in its Click, and its Cancel property set to True. The Esc key would then count as a Click on that CommandButton. This even works for a button that is "invisible" (Style = 1) and/or sitting off of the viewable portion of the form, say, at -1000, -1000 (But if you're going to have a non-visible Cancel button, set its TabStop property to False to keep the focus always on a visible control.)

Cheers,
Willson

ENTIRE THREAD

Assingning a key to close a form Posted by FoxGuy Degante @ 8/30/2007 7:57:10 PM
RE: Assingning a key to close a form Posted by Borislav Borissov @ 8/30/2007 8:01:03 PM
RE: Assingning a key to close a form Posted by Ulhas Amrite @ 8/31/2007 8:40:54 AM
RE: Assingning a key to close a form Posted by Borislav Borissov @ 8/31/2007 9:18:05 AM
RE: Assingning a key to close a form Posted by Ulhas Amrite @ 8/31/2007 10:10:26 AM
RE: Assingning a key to close a form Posted by Ken Murphy @ 8/31/2007 3:26:11 PM
RE: Assingning a key to close a form Posted by Borislav Borissov @ 8/31/2007 3:50:48 PM
RE: Assingning a key to close a form Posted by Ulhas Amrite @ 9/3/2007 2:49:11 PM
RE: Assingning a key to close a form Posted by Ken Murphy @ 9/3/2007 2:57:20 PM
RE: Assingning a key to close a form Posted by Willson de Veas @ 8/31/2007 12:44:10 AM