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

# TCustomActionList.IndexOfName

Gets the ordinal position for the action with the specified name.

## Declaration

Source position: actnlist.pas line 109

`public function TCustomActionList.IndexOfName(`
`const ActionName: string`
`):Integer;`

## Arguments

`ActionName` |  | Name for the action to locate in the Actions property.

## Function result

Ordinal position where the action with the specified name is stored, or -1 when not found.

## Description

IndexOfName is an Integer function used to get the position in Actions where the TAction instance with the name in ActionName is stored.

IndexOfName visits the class instances in Actions (in reverse order) and calls the CompareText routine in SysUtils to perform a case-insensitive comparison to Name properties in each. The return value contains the ordinal position in Action where the first matching name was located, or -1 when ActionName is not found.

IndexOfName is used to implement the ActionByName method.

## See also

TCustomActionList.Actions |  | Provides indexed access to actions in the list by their ordinal position.
TCustomActionList.ActionCount |  | The total number of actions in the action list.
TCustomActionList.ActionByName |  | Returns an action identified by its name.
TAction |  | TAction is the basic action object used in the LCL.
TComponent.Name