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

TWinControl.CanFocus

Is this control allowed to receive the focus when parent form is visible?

Declaration

Source position: controls.pp line 2407

public function TWinControl.CanFocus: Boolean; virtual;

Description

Checks if the control can get focus when parent form is visible, i.e. if all its parents except the form are visible and enabled.

A possible usage:

if FormFoo.EditBar.CanFocus then
  FormFoo.ActiveControl := FormFoo.EditBar;
Remark: CanFocus returns True even if the parent form is not actually visible, and a subsequent SetFocus call could throw an exception. Use CanSetFocus in this case.

See also

TWinControl.CanSetFocus

  

Is this control allowed to receive the focus?

TWinControl.SetFocus

  

Ensures that the control or window handle has focus.

TWinControl.CanFocus

  

Is this control allowed to receive the focus when parent form is visible?


Version 3.2 Generated 2024-02-25 Home