Sign in Join
FPDoc Onlineexperiment

TCustomTabControl.MaybeSelectFirstControlOnPage procedure

Member of TCustomTabControlprotectedIn unit ComCtrls

Updates the ActiveControl on the parent form when the specified page becomes active.

Declaration

pascal
procedure MaybeSelectFirstControlOnPage(APage: TCustomPage); virtual

Description

MaybeSelectFirstControlOnPage is a method used to ensure that the active control on a form is properly updated when the page on the tab control is changed. It prevents the tabbed control from stealing focus if the active control on the parent form is not the tabbed control or one of its child controls.

APage is used to find the next control in the tab order for the page. If a control is found, it is assigned as the ActiveControl on the parent form.

No actions are performed in the method if any of the following conditions are detected:

  • The parent form for the tab control has not been assigned.
  • APage has not been assigned.
  • APage is not visible.
  • APage is not enabled.
  • APage does not have any child controls.

MaybeSelectFirstControlOnPage is called from the Change method, and occurs when a new value is assigned to the TabIndex property. It occurs after the current Page on the tab control has been made visible and given focus. It is called before the OnChange event handler is signalled.

Added in LCL version 3.4.

Errors

Raises an EAssertionFailed exception if a value has not been assigned to the APage argument.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.