This special property describes the number of columns and their location in the grid. The first column always displays in column 1. Additional columns display at the locations set by DISPLAY-COLUMNS. Columns are measured with the standard font. Each time you set DISPLAY-COLUMNS to a positive value, a new display column is defined. Setting DISPLAY-COLUMNS to 0 clears all of the columns (except column 1). Usually, you set DISPLAY-COLUMNS in a list, like this:
DISPLAY-COLUMNS = (1, 21, 35)
This example sets three columns, one starting at column 1, the next starting at column 21 and the last starting at column 35. The last column extends to the end of the grid (see VIRTUAL-WIDTH for more information).
The maximum number of columns you can set is 30. Any columns over 30 will be ignored by the runtime and will not display.
In a grid without horizontal scrolling specified (see the HSCROLL style common property), you can have a record occupy multiple rows in a grid. To do this, restart numbering columns at 1 after setting the first row's columns. For example, the following describes a grid with records that span two rows, with three columns on the first row and two columns in the second:
DISPLAY-COLUMNS = (1, 21, 35, 1, 21)
On the screen, one record of this grid would look something like this:
column 1 column 2 column 3 column 4 column 5
You can also use columns to hide data. A column set beyond the right side of the grid is not visible on the screen. You can use this behavior to store information in the grid that your program needs to associate with records, but that you do not want to be seen by the user. One potential use for this feature is to store a file record's primary key value in the hidden column so that you can retrieve the full record easily when the user selects an item in the grid.