Set Multiple Cells - GRID SENDMSG() Function 21
Syntax
TF$=SENDMSG(sysgui,id,21,number_of_cells,cell_contents${,context{,ERR=lineref}})
Description
This function sets the values in one or more contiguous cells with one command.
Parameter |
Description |
sysgui |
SYSGUI channel. |
id |
Grid control ID. |
21 |
Number of this SENDMSG() function. |
number_of_cells |
Number of cells to fill in. |
cell_contents$ |
Linefeed-terminated string with values to place in grid. |
The number_of_cells parameter specifies how many cells are to be filled. The cell_contents$ parameter contains one or more strings delimited by linefeeds ($0A$). When the function executes, the first value is placed in the first column of the current row. Then the second value is placed in the next cell to the right. If number_of_cells is greater than the number of columns in the grid, values will be set in the entire current row, then the next row or rows until all the cell entries are used. If all the cell entries are used before the specified number of cells have been filled, the values from the beginning of the string are reused.
This function works on heading grids as well as main grids. The return value is a one-byte string that indicates the success or failure of an operation; $01$ indicates success, $00$ indicates failure.
System default style, alignment, and colors are used. If any nondefault display attributes had been set in a cell with Draw Cell - Grid SENDMSG() Function 54, those attributes are reset to defaults by this function.
Example
The following example creates a grid with three rows and three columns and fills in the first five cells:
sysgui=unt;open (sysgui)"X0"
print (sysgui)'window'(50,50,200,150,"Grid Program",$$,$$)
print (sysgui)'grid'(100,20,20,160,120,$9040$,3,3,3)
result$=sendmsg(sysgui,100,68,150/4,$$); rem row height
for col=0 to 2
result$=sendmsg(sysgui,100,36,col,chr(51)); rem column width
next col
result$=sendmsg(sysgui,100,21,5,"First"+$0A$+"Second"+$0A$+"Third"+$0A$)
escape