GotFocus Event

Applies To   See Also

Occurs when an object receives the focus, either by user action or through code.

Syntax

PROCEDURE Object.GotFocus
[LPARAMETERS nIndex]

Parameters

nIndex

Uniquely identifies a control if it is in a control array.

Remarks

Use the GotFocus event to specify actions to occur when an object receives the focus. For example, by attaching a GotFocus event to each control on a Form, you can guide a user by displaying brief instructions or status bar messages. You can also provide visual cues by enabling, disabling, or showing other controls that depend on the control that has the focus.

A control receives the focus by user action, such as a mouse click, or when the SetFocus method is called in code.

An object can receive the focus only if its Enabled and Visible properties are set to true (.T.). To customize the keyboard interface for moving the focus, set the tab order or specify access keys for controls on a form.

The GotFocus event occurs after the Activate event for the control's container.