Occurs when an object loses the focus
Object.OnLostFocus()
The OnLostFocus event syntax has the following parts:
Name |
Type |
Description |
Object |
A control |
A control or the AForm object |
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:
If the object is an out-of-process component.
If the object isn't written in ATEasy.
In the development environment when calling a DLL built in ATEasy.
txtNumber.OnLostFocus()
{
if Val(text)<1
MsgBox("Illegal numeric value")
SetFocus()
endif
}
|