Sign in Join
FPDoc Onlineexperiment

TCustomListBox.ItemAtPos function

Member of TCustomListBoxpublicIn unit StdCtrls

Get the item index for the given client coordinates.

Declaration

pascal
function ItemAtPos(const Pos: TPoint; Existing: Boolean): Integer

Arguments

Pos

The item position.

ExistingTrue when the index is requested for insertion of a new item.

Function result

The calculated item index, can be out of the Items bounds.

Description

ItemAtPos is an Integer function used to get the index position in Items for the value at the specified screen coordinates.

Pos is TPoint instance with the X and Y coordinates used in the method.

Existing indicates whether the return value is set to -1 or the number of entries in Items when Pos refers to entry which does not exist. When Existing is set to True, -1 is returned for an invalid entry. Otherwise, the value in Item.Count is returned.

ItemAtPos calls GetIndexAtXY using the X and Y values in Pos to locate the index for the item.

See also

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