Control Object Properties

AutoFit

Force Grid to Resize Column to Fit Contents

Description

This property, when set to any value, forces the associated grid to resize the column currently selected by the 'Colno or 'Column property to the width required to fit its contents.

If the currently selected column is set to zero, all columns in the grid will be resized.

The value set in 'AutoFit indicates how many rows to check, with zero indicating all rows and the column header. Any value other than zero specifies the number of rows (starting at the first row) to take into account in computing the new column width. A non-zero setting may be used to minimize the time it might take to scan all the rows in a large grid.

Reading this property returns zero, as the value of the property itself has no meaning, and simply the act of setting it causes the grid to be updated.

Note:
If a column has the ColumnSizeLock property set to On or a ColumnWidth of zero (hidden), the width will not be adjusted unless the column number is explicitly set to that column (i.e. 'Colno is not zero).

(The AutoFit property was added in PxPlus 2017.)

Used By

GRID