The Basics > Choosing a Column Layout > Switching between layout types |
If you define a design-time column layout, the grid will not automatically change the layout at run time, as it assumes that you want total control of the display. The grid considers you to have defined a design-time column layout if you chose the Retrieve Fields option from the grid's context menu or modified any properties in either the Columns or Splits property pages.
You can clear the design-time layout by choosing the Clear Fields option of the grid's context menu or by invoking the grid's ClearFields method in code:
Example Title |
Copy Code
|
---|---|
' Clear column layout.
TDBGrid1.ClearFields
|
After this statement is executed, the grid will again respond automatically to layout changes at run time.
Conversely, you can cancel the grid's automatic layout behavior by invoking the grid's HoldFields method in code:
Example Title |
Copy Code
|
---|---|
' Cancel automatic layout.
TDBGrid1.HoldFields
|
After this statement is executed, the grid will stop automatically changing the layout at run time, and uses the current column layout for all subsequent Recordset display. This is especially useful if you need to refresh the data control the grid is bound to while maintaining the current grid layout.
By using the ClearFields and HoldFields methods, you can alternate the grid's display between automatic layout and customized layout.