Arranging the Order of Persistent Columns
Go Up to Creating a Customized Grid
The order in which columns appear in the Columns editor is the same as the order the columns appear in the grid. You can change the column order by dragging and dropping columns within the Columns list box.
To change the order of a column
- Select the column in the Columns list box.
- Drag it to a new location in the list box.
You can also change the column order at run time by clicking on the column title and dragging the column to a new position.
Note: Reordering persistent fields in the Fields editor also reorders columns in a default grid, but not a custom grid.
Warning: You cannot reorder columns in grids containing both dynamic columns and dynamic fields at design time, since there is nothing persistent to record the altered field or column order.
At runtime, a user can use the mouse to drag a column to a new location in the grid if its DragMode property is set to dmManual. Reordering the columns of a grid with a State property of csDefault state also reorders field components in the dataset underlying the grid. The order of fields in the physical table is not affected. To prevent a user from rearranging columns at run time, set the DragMode property of the grid to dmAutomatic.
At runtime, the OnColumnMoved event of the grid fires after a column has been moved.