DefColWidth Property (TDBCombo)
This property returns or sets the default width for all control columns in terms of the coordinate system of the control's container.
object.DefColWidth= single
Read/Write at run time and design time.
Property applies to TDBList and TDBCombo controls.
For bound controls, the DefColWidth property is respected under the following circumstances:
· When you execute the Retrieve Fields command at design time.
· When the control's layout is initialized at run time.
· When a new column is created at run time.
For unbound controls, the DefColWidth property is only respected when a new column is created at run time.
If you set the DefColWidth property to 0, the control automatically sizes all columns based on either the width of the column heading or the display width of the underlying field, whichever is larger. For example, to set the default column width to the width of the first column:
TDBList1.DefColWidth = TDBList1.Columns(0).Width
Note: Setting the DefColWidth property at run time does not affect existing columns, only those that are subsequently created in code.
In bound mode, some data sources do not provide text field widths when requested by the control. Therefore, if DefColWidth is 0, the actual column widths may not be what you expect since the control must supply a default width.
See Also