Share via


Overview | Methods | Fields | This Package | All Packages

OverviewMethodsFieldsThis PackageAll Packages

Control.addOnLeave

Assigns a delegate to the leave event.

Syntax

public final void addOnLeave( EventHandler value )

Parameters

value

The EventHandler delegate to be notified when the event occurs.

Remarks

Passing an event handler as a parameter to this method is equivalent to setting the leave event to that method in the Properties window. The leave event occurs when the active control for the form changes from this control or a child of this control to a control on the form other than this control or a child of this control. If the form is active when this event occurs, the focus moves to the new active control on the form. If this control is the active control for an active form, this event is not triggered when the form is deactivated.

Data validation for a control should take place in the handler for the leave event of the control or one of its containers. Use the setActiveControl method in your event handler to prevent the user from leaving a control without entering valid data.

See Also   removeOnLeave