GRID Mnemonic - Create a Grid Control
Syntax
'GRID'(id,x,y,w,h,flags$,initrows,initcols,maxcols{,colheadheight,colheadid} {,rowheadwidth,rowheadid})
Description
For BBj-specific information, see the GRID Mnemonic - Create a Grid Control.
The 'GRID' mnemonic creates a grid control. Create grids and all other controls in resource files rather than with mnemonics. By using ResBuilder to define a grid, attributes such as column headers can be set without writing Visual PRO/5 code and changed without modifying code. All attributes of a grid can be modified at run time, including the number of rows without losing flexibility.
In versions prior to Visual PRO/5 2.10, the flag used to display vertical grid lines is $0020$. For versions PRO/5 2.10 and later, this flag is $8000$. When migrating to 2.10 from earlier versions, it is necessary to either change the $0020$ flag to $8000$ or setSETOPTSbyte 7, bit $08$.
|
Parameter |
Description |
||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
id |
A positive integer that will be used to identify the grid. This number must be unique among the controls in the current window. |
||||||||||||||||||||||||||
|
x |
Horizontal position of the upper-left corner of the grid in currently-scaled CONTROL units, relative to the inside of the window containing it. |
||||||||||||||||||||||||||
|
y |
Vertical position of the upper-left corner of the grid in currently-scaled CONTROL units, relative to the inside of the window containing it. |
||||||||||||||||||||||||||
|
w |
Width of the entire grid in currently scaled CONTROL units. |
||||||||||||||||||||||||||
|
h |
Height of the entire grid in currently scaled CONTROL units. |
||||||||||||||||||||||||||
|
flags$ |
May be empty or a two-byte binary string composed of any hexadecimal addition of the following values:
In Visual PRO/5 versions prior to 2.10, the flag for this feature was $0020$. When migrating to 2.10 from earlier versions, it is necessary to either change the flag to $8000$ or set SETOPTS byte 7, bit $08$. |
||||||||||||||||||||||||||
|
initrows |
Initial number of rows in the grid. |
||||||||||||||||||||||||||
|
initcols |
Initial number of columns in the grid. |
||||||||||||||||||||||||||
|
maxcols |
Maximum number of columns the grid can contain. The number of columns can be modified at run time. Defining more columns than necessary in this parameter will waste workspace memory. |
||||||||||||||||||||||||||
|
colheadheight |
Optional parameter to define the height of the column headers in pixels. May only be used when flag $0004$ is turned on. |
||||||||||||||||||||||||||
|
colheadid |
Optional parameter to define a unique control ID for the grid that displays column headers. May only be used when flag $0004$ is turned on. |
||||||||||||||||||||||||||
|
rowheadwidth |
Optional parameter to define the width of the row headers in pixels. May only be used when flag $0002$ is turned on. |
||||||||||||||||||||||||||
|
rowid |
Optional parameter to define a unique control ID for the grid that displays row headers. May only be used when flag $0002$ is turned on. |
Examples
The following code creates a grid control with ID 100 that has three rows and three columns, vertical and horizontal lines, a raised edge, and no column or row headers:
|
The following code creates a grid control with ID 100 that has three rows and three columns, vertical and horizontal lines, a client edge, and column and row headers. Note that the bounding rectangle is larger in this example than the example above so that the grid body will display without truncation.
|