Share via


When Event

Occurs before a control receives the focus.

PROCEDURE Control.When

Remarks

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

If the When event returns true (.T.), the default control receives the focus. If the When event returns false (.F.), the control does not 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

Reference

GotFocus Event

Valid Event

Other Resources

Events (Visual FoxPro)

Language Reference (Visual FoxPro)