skip to main content

Controls Reference : GRID : Properties : Display-Columns

Display-Columns
This property can be used to set or retrieve the starting position of each column in the Grid control. As a consequence, it defines the number of columns. The width of each column depends on the starting position of the next column. The width of the last column can be defined with the Virtual-Width property. A column cannot be larger than the Grid width, so the Grid Size specifies also the maximum size of a column.
Since this property must be set for each column, a list of values is needed in order to determine the starting position of each column.
When values are enclosed between parentheses, a new list is defined at once. The snippet below defines a grid with three columns, 10 characters wide. The first column always starts at 1.
DISPLAY-COLUMNS = (1, 11, 21)
Setting this property to 0 resets the list.
When a single value greater than zero is set, it is appended to the list. This is useful to define a user-defined appearance.
MODIFY MY_GRID, DISPLAY-COLUMNS = 0 | Resets the list of values
MOVE 1 TO ColumnPosition
PERFORM VARYING ColumnIdx FROM 1 BY 1 UNTIL ColumnIdx > ColumnCount
   MODIFY MY_GRID, DISPLAY-COLUMNS = ColumnPosition | Sets the position of the next column. The first time is 1.
   ADD CustomColumnSize(ColumnIdx) TO ColumnPosition
SUBTRACT 1 FROM ColumnPosition
MODIFY MY_GRID, VIRTUAL-WIDTH = ColumnPosition
When inquired, this property returns a buffer with the complete list of values, separated by a spaces. The value contained in that buffer can be used to restore the columns width with a single statement.
MODIFY MY_GRID, DISPLAY-COLUMNS = (11121)
INQUIRE MY_GRID, DISPLAY-COLUMNS IN Buffer | Buffer contains "1 11 21"
MOVE "1 21 31" TO Buffer
MODIFY MY_GRID, DISPLAY-COLUMNS = Buffer | The first column is now 20 characters wide.
 
Example - Modify a grid to set column offsets
procedure division.
  modify screen-1-gr-1
         display-columns ( 1 21 29 )

Copyright (c) 2017 Veryant
Contact us
Please share your comments on this manual or on any
Veryant product documentation with the email button at the top left