OnLostFocus Event

Occurs when an object loses the focus

Syntax

Object.OnLostFocus()

The OnLostFocus event syntax has the following parts:

 

Name

Type

Description

Object

A control

A control or the AForm object

Comments

Occurs when an object loses the focus, either by user action, such as tabbing to or clicking another object, or by changing the focus in code using the SetFocus method.

An OnLostFocus event procedure is primarily useful for verification and validation updates. Using OnLostFocus can cause validation to take place as the user moves the focus from the control. Another use for this type of event procedure is enabling, disabling, hiding, and displaying other objects as in an OnGotFocus event procedure. You can also reverse or change conditions that you set up in the object's OnGotFocus event procedure.

If an .exe file built by ATEasy displays a dialog box created by a .dll file also built in ATEasy, the .exe file's form will get OnDeactivate and OnLostFocus events. This may be unexpected, because you should not get the Deactivate event:

Example

txtNumber.OnLostFocus()

{

if Val(text)<1

MsgBox("Illegal numeric value")

SetFocus()

endif

}

Applies to

 

AButton

AListBox

ASlider

ACheckBox

ALog

ASwitch

AComboBox

ARadioButton

ATextBox

AForm

AScrollBar

 

See Also

Enabled, OnGotFocus, SetFocus