Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why does pressing the Escape key cause changes on the form to be cancelled instead of just causing the form to close?

0
Posted

Why does pressing the Escape key cause changes on the form to be cancelled instead of just causing the form to close?

0

On forms based on the Form_Toolbar class and subclasses, pressing the Escape key causes the Click method of the toolbars Cancel button to be run. This is consistent with other types of forms where you use the Cancel property of a button to cause the buttons Click method to be run when the user presses the Escape key. The definition of the Cancel property of a commandbutton in the VFP help file reads: “Specifies whether a CommandButton or OLE Container control is the Cancel button; that is, if the user pressed the ESC key, the Cancel buttons Click event would occur.” The point being, that pressing the Escape key should cancel some process, not necessarily close the form. You can make the pressing of the Escape key do what ever you like by changing the code in the Activate event of the Form_Toolbar class in the VPMForms class library. Just change the ON KEY LABEL ESC command.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123