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

# TCustomTabControl.IndexOfTabAt

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

## Declaration

Source position: comctrls.pp line 450

`protected function TCustomTabControl.IndexOfTabAt(`
`X: Integer;`
`Y: Integer`
`):Integer; virtual; overload; function TCustomTabControl.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.

## Function result

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

## Arguments

`P` |  | TPoint instance with the client coordinates for the requested tab index.

## 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));