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

# TCustomTabControl.InsertPage

Inserts the specified page into the page list and updates both the page and the control.

## Declaration

Source position: comctrls.pp line 464

`protected procedure TCustomTabControl.InsertPage(`
`APage: TCustomPage;`
`Index: Integer`
`); virtual;`

## Arguments

`APage` |  | TCustomPage instance inserted in the page list at the specified ordinal position.
`Index` |  | Ordinal position in the page list where the specified page object is inserted.

## Description

InsertPage is a method used to insert the page object in APage into the page list at the ordinal position specified in Index.

APage is the TCustomPage instance inserted as a new tab on the tabbed control. Values in the Flags property in APage are updated to reflect the page object state, both before the page is stored and after the page has been inserted.

InsertPage sets the Parent property in APage to the current tab control instance. The SetControlIndex is called (when needed) to set the Z-axis order for the page object on the parent control.

If an ActivePage has not been assigned for the control, the value in Index is stored in the PageIndex property to make the new page the active page. Values in the ControlStyle property are updated to indicate whether the page is the active page on the IDE design surface.

No actions are performed in the method if the page object in APage is already stored in the page list.

## See also

TCustomTabControl.IndexOf |  | Gets the ordinal position in the page list for the specified page object.
TCustomTabControl.Page |  | Provides indexed access to the page objects used on the tabbed control.
TCustomTabControl.PageCount |  | Returns the number of page objects stored in the internal page list for the tabbed control.
TCustomPage |  | The base class for TTabSheet.
TNBPages.Insert |  | Inserts a new page with the given name at the specified position in PageList.