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

# TColumn.GetDefaultWidth

Gets the effective width for the column.

## Declaration

Source position: dbgrids.pas line 278

`protected function TColumn.GetDefaultWidth: Integer; override;`

## Function result

Effective width for the column.

## Description

GetDefaultWidth is an overridden Integer function used to get the effective width for the column. The return value is calculated using the Grid and its Canvas to find the space needed for the Field in the column. When the Grid has Options that include the value dgTitles, Title.Caption and Title.Font are included in the calculation. GetDefaultWidth calls the CalcColumnFieldWidth function to get the canvas width used as the return value.

The return value is -1 if the Grid has not been assigned for the column. The return value contains Grid.DefaultColWidth when Field has not been assigned in the column.

## See also

TGridColumn.GetDefaultWidth