Return Key and Forms

Last update :
June 9, 1997

Problem:

When Pragma displays a form, that form can usually be closed in three ways:

  1. By clicking on the "X" in the left upper corner of the caption bar.
  2. By clicking on a "Cancel" button, if the form has one (They all should have one).
  3. By hitting the ESCAPE key.
  4. By hitting the RETURN key.

This last feature, hitting the RETURN key, is not always desired, since many people are used to abuse the RETURN key and then find themselves with a closed form.

Solution:

To disable the RETURN key add an extra button to your form. Set the property Visible to FALSE and the property Default button to TRUE. There is no need to write an event verb for the button.

That invisible button now becomes the default button and every time that the RETURN key is pushed the default button's event will be triggered. Since the event verb is empty, nothing will happen. Please note that only one button can be the default button for a form.

Nothing prevents you to use the event verb of the default button, enabling you to trigger it with the RETURN key. But be careful. Not only the RETURN key triggers the event verb of the default button.

 

00-05-08
lip_tec3.gif
t_ret_ky.htm