Share via


GotFocus Event

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

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.

Note   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.

See Also

Activate Event | ActiveControl Property | Click Event | Deactivate Event | Enabled Property | LostFocus Event | SetFocus Method | TabIndex Property | TabStop Property | Visible Property | Applies To: CheckBox | ComboBox | CommandButton | Container Object | Control Object | EditBox | Form | ListBox | OLE Bound Control | OLE Container Control | OptionButton | Spinner | TextBox