Set Number of Columns - GRID SENDMSG() Function 66
Syntax
COLS$=SENDMSG(sysgui,id,66,cols,$${,context{,ERR=lineref}})
Description
This function sets the number of columns in the specified grid control.
Parameter |
Description |
sysgui |
SYSGUI channel. |
id |
Grid control ID. |
66 |
Number of this SENDMSG() function. |
cols |
Number of columns. Valid values are 0 to 255. (Columns are zero-based.) The number of columns can be changed at any time but cannot exceed the maximum number of columns specified when the grid was created. If the number of columns specified exceeds the maximum, only the maximum number of columns will be set. |
$$ |
Always null. |
This function is valid only for main grids, not heading grids (which grids are automatically updated if they exist). It does not change the size of the grid control, so reducing the number of columns may cause the right side of the grid's space to appear blank.
The return value is a binary representation of the number of columns actually set by this message. Use DEC(COLS$) to get the numeric representation.
Warning: Always create columns in a grid before adding rows. Failure to do so will result in excessive memory usage and performance degradation.
Example
The following example creates a grid with three columns and reduces the number of columns to two:
sysgui=unt; open (sysgui)"X0"
print (sysgui)'window'(0,20,650,120,"Grid Sample",$00000082$,$FF$)
print (sysgui)'grid'(100,20,20,580,74,$0866$,3,3,5,18,101,30,102)
cols$=sendmsg(sysgui,100,66,2,$$)
print dec(cols$)
escape