TWinControl.CanSetFocus function
Is this control allowed to receive the focus?
Declaration
function CanSetFocus: Boolean; virtualDescription
Checks if the control can receive focus, i.e. if all its parents are visible and enabled.
A possible usage:
if MyControl.CanSetFocus then MyControl.SetFocus;
CanSetFocus should be preferred over
CanFocus if used
in CanSetFocus/SetFocus combination because it checks also if the parent form
can receive focus and thus prevents the "cannot focus an invisible window"
LCL exception.
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
