Sign in Join
FPDoc Onlineexperiment

TCustomTabControl.IndexOfTabAt function

Member of TCustomTabControlprotectedIn unit ComCtrls

Returns the ordinal position for the visible tab located at the specified client coordinates.

Declaration

pascal
function IndexOfTabAt(X: Integer; Y: Integer): Integer; virtual
 ; overload
function IndexOfTabAt(P: TPoint): Integer; virtual; overload

Arguments

X

Horizontal client coordinate for the tab position located in the method.

Y

Vertical client coordinate for the tab position located in the method.

P

TPoint instance with the client coordinates for the requested tab index.

Function result

Ordinal position in Tabs for the visible tab located at the specified coordinates, or -1 when not found or available.

Description

IndexOfTab is an overloaded method in TCustomTabControl used to get the position for a tab located at the client client coordinates. The overloaded variants allow the client position to be specified as separate Integer values, or as a TPoint instance where the X and Y members contain the client-relative coordinates.

IndexOfTabAt calls the GetTabIndexAtPos method in the widgetset class to get the ordinal tab position in the return value. The return value is -1 if a tab is not visible at the specified coordinates, or when the handle has not been allocated for the widget instance.

Example Usage:

APos := TabControl1.IndexOfTabAt(TabControl1.ScreenToClient(Mouse.CursorPos));

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