Skip to main content

TcxCustomGridTableItem.ApplyBestFit(Boolean,Boolean) Method

Adjusts the width of the View item to display its content in full.

Declaration

procedure ApplyBestFit(ACheckSizingAbility: Boolean = False; AFireEvents: Boolean = False); virtual;

Parameters

Name Type Description
ACheckSizingAbility Boolean

If True, the procedure checks if the item can change its width. If False, the procedure adjusts the item’s width even if restrictive options are set (that is, if the item’s Options.HorzSizing property and the View’s OptionsCustomize.ColumnHorzSizing property are set to False).

AFireEvents Boolean

True to raise the OnColumnSizeChanged event if the View item changes its width; otherwise, False.

Remarks

The ApplyBestFit procedure iterates through all data records and calculates the maximum width of item cells. You can use the View’s OptionsBehavior.BestFitMaxRecordCount property to limit the number of processed records and improve performance. Use the item’s BestFitMaxWidth property to set the item’s maximum width constraint to maintain the grid View layout.

Note

Call the ApplyBestFit procedure only if the View and item are visible.

A user can double-click the right edge of the item to display all its content. To prevent a user from changing the item’s width, set the item’s Options.HorzSizing property or the View’s OptionsCustomize.ColumnHorzSizing property to False.

See Also