[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'Forms' (#lcl)

TCustomForm.ActiveControl

Specifies the active control on the form.

Declaration

Source position: forms.pp line 770

public property TCustomForm.ActiveControl : TWinControl
  read FActiveControl
  write SetActiveControl;

Description

ActiveControl is a TWinControl property which contains the control which has focus on the form. The property value can be Nil if the form is hidden, disabled, or has never been activated.

Setting a new value for the property causes validity checks to be performed to ensure that the specified control can receive focus when the form is Visible. An EInvalidOperation exception is raised when the new property value contains:

The SetWindowFocus method is called if the form is Active, and the ActiveChanged method is called.

The value in ActiveControl is updated in the FocusControl and DefocusControl methods.


Version 3.2 Generated 2024-02-25 Home