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

# TCustomHeaderControl.CreateSection

Creates a new header section for the control.

## Declaration

Source position: comctrls.pp line 4063

`protected function TCustomHeaderControl.CreateSection: THeaderSection; virtual;`

## Function result

THeaderSection instance created in the method.

## Description

CreateSection is a THeaderSection function used to create a new value in the Sections collection for the control. The return value contains an instance of THeaderSection (or a descendant class) created in the method with the Sections collection as the owner of the item.

The OnCreateSectionClass event handler is signalled (when assigned) at run-time to allow a custom item class to be used to create the collection item. The handler returns the class type instantiated in the method. By default, the class type is THeaderSection but can be overridden in OnCreateSectionClass to use a THeaderSection descendant.

OnCreateSectionClass is not signalled at design-time; THeaderSection is always used as the item class when added to the Sections property using the Object Inspector property editor.

CreateSection is called from the AddItem method in the Sections (THeaderSections) collection, and occurs when an item class instance is not passed as an argument to the collection method.

## See also

TCustomHeaderControl.Sections |  | Sections - the short segments of the header separated by vertical bars that function as the elementary selection units of the header.
TCustomHeaderControl.OnCreateSectionClass |  | Event handler signalled to get the class type used to create a new section for the header control.
THeaderSections.AddItem |  | Adds the specified header section at the position specified in Index.
THeaderSections.Items |  | Items - the series of individual HeaderSections in the collection.
THeaderSection |  | Implements a section displayed on a TCustomHeaderControl / THeaderControl instance.