When Event

Occurs before a control receives the focus.

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.

Note   The Grid control does not have a GotFocus event, so only When fires.

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

See Also

GotFocus Event | Valid Event

Applies To: CheckBox | ComboBox | CommandButton | CommandGroup | EditBox | Grid | ListBox | OptionButton | OptionGroup | Spinner | TextBox