Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Borislav Borissov
  Where is Borislav Borissov?
 Sofia
 Bulgaria
 Borislav Borissov
 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: 143673 # Views: 3 # Ratings: 0
Version: Visual FoxPro 9 Category: General VFP Topics
Date: Thursday, August 30, 2007 8:01:03 PM         
   


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

Put in KeyPress Event of the form:
LPARAMETERS nKeyCode, nShift
IF nKeyCode == 27
   NODEFAULT
   IF thisform.QueryUnload()
      thisform.release()
   ENDIF
ENDIF

and set KeyPreview = .t.

If you have a button that close the form you could sent its property Cancel = .t.. That way you don't have to mess with KeyPress event.

-----------------
Borislav Borissov

Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.

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