When Event

Applies To   See Also

Occurs before a control receives the focus.

Syntax

PROCEDURE Control.When
[LPARAMETERS nIndex]

Parameters

nIndex

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

Remarks

If the When event returns true (.T.), the default control receives the focus. If the When event returns false (.F.), the control doesn't receive the focus. The order of events when a control gains the focus is:

  1. When event

  2. GotFocus event

For ListBox controls, the When event occurs each time a user moves the focus between items in the list by clicking on items or by moving the selection with the arrow keys.

For all other controls, the When event occurs when an attempt is made to move the focus to the control.