lostFocus

lostFocus(cntrl: Control input);          (Form)

lostFocus(control: control-type input);   (Control)

The lostFocus event occurs when a control loses the focus, either by a user action such as tabbing to or clicking another object or by changing the focus in logic using the setFocus method.

A copy of this event is first sent to the form. As a form does not have focus unless there are no input controls and this event is not returned for a form, use the deactivate event for a form.

Use the lostFocus event for verification and validation updates. Using the lostFocus event can cause validation to take place as the user leaves the control.

You can also use the lostFocus event to enable, disable, hide, or display other objects, as in a gotFocus event. You can also reverse or change conditions that you set up in the gotFocus event of an object.

When focus is lost by a control, a lostFocus event is also sent to the form, identifying the control that lost focus. The form itself never has the focus, but this event (in conjunction with the gotFocus event) provides a centralized place where all focus change events can be monitored in a similar way to the keyDown, keyPress, and keyUp events of the Form class.