Alt-F4 to close the current form and NOT the application.  
Author Message
Aleniko29139





PostPosted: Visual FoxPro General, Alt-F4 to close the current form and NOT the application. Top

Is there a way to set VFP so alt-F4 closes the current open window within VFP instead of the vfp application itself

Thx.


Visual FoxPro1  
 
 
Don Higgins





PostPosted: Visual FoxPro General, Alt-F4 to close the current form and NOT the application. Top

Sure, set KeyPreview to true and in the keypress event have this code:

LPARAMETERS nKeyCode, nShiftAltCtrl

CASE nKeyCode = 107

** Letter ALT + F4 for EXIT click event

** assumes command button on form is called cmdExit

THISFORM.cmdExit.Click()

endcase



 
 
Aleniko





PostPosted: Visual FoxPro General, Alt-F4 to close the current form and NOT the application. Top

Don;

It woarks like a charm... As long as its not ALT-F4.
Any key is being trapped in the Keypress, but when I use alt+F4 the VFP application itself closes before the Keypress will intercept it.

Any other ideas

Thx.

 
 
CetinBasoz





PostPosted: Visual FoxPro General, Alt-F4 to close the current form and NOT the application. Top

Ctrl+F4. They are standard window keys for MDI applications.

If you desperately need it then you can override using winAPI code.


 
 
Aleniko





PostPosted: Visual FoxPro General, Alt-F4 to close the current form and NOT the application. Top

No, not THAT important...

Thanks everyone.