Sign in Join
FPDoc Onlineexperiment

TWinControl.SetFocus procedure

Member of TWinControlpublicIn unit Controls

Ensures that the control or window handle has focus.

Declaration

pascal
procedure SetFocus; virtual

Description

SetFocus is a procedure used to give focus to the current control. SetFocus calls GetParentForm for the control instance, and uses its FocusControl method to change the focused control.

If the parent Form is unassigned (contains Nil), the LCL interface is used to change focus to the handle for the control. No actions are performed in the method when Form is unassigned and the control does not have an allocated handle.

An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.