The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....


Class: TNTabEd
Declaration: function AutoColWidth (ColNr: longint; IncludeHeader: boolean; Addon: integer): integer;

The function AutoColWidth adjusts the column width so that every cell of the column ColNr is fully readable. Note, that the optimum width depends on the contents of the cells. The parameter ColNr may take any value between -1 and the number of available columns, NrOfColumns. A value of -1 addresses the column containing the row attributes (if visible), a zero value refers to the row identifiers, any other value refers to the corresponding column.

The column headers are included in the calculation of the optimum column width if IncludeHeader is set TRUE. The property Addon defines an additional value which is added to the optimum column width. Addon may be negative (to reduce the column width); however, no column will be displayed using less than 4 pixels. The function returns the new width of the column (in pixels).

Example: This method is used in the following example program (see for downloading the code): ntabedit

Last Update: 2012-Oct-20