QG_SetSelection

QG_SetSelection(areaRef; targetCell; cellSelection):errorCode
areaRef Longint QGrid area reference
targetCell Longint Single cell index to select
cellSelection Array longint Multiple cell indexes to select
error Longint Error result

Specify which grid cell(s) to select

Parameter areaRef is the QGrid area reference. If areaRef is not a valid QGrid area reference, qg_paramErr error is returned.

When the qg_SelectOneCell selection option is in effect, parameter targetCell should hold the index of the cell to be selected. In this case parameter cellSelection is ignored and can be omitted.

If the qg_SelectManyCells selection option is in effect, parameter cellSelection holds the array of cell indexes to be selected. If parameter cellSelection is not present, then the user selection is set to the single cell indicated in the targetCell parameter.

NOTE When a user selection is applied, any previous user selection is replaced by the new one.

TIP To clear the current user selection call QG_SetSelection with parameter targetCell set to 0 and omit parameter cellSelection.

Examples

   // Select the first 3 cells in area xGrid.
   // Requires selection option qg_SelectManyCells to be in effect.

C_LONGINT($err)

ARRAY LONGINT($cells;3)
$cells{1}:=1
$cells{2}:=2
$cells{3}:=3

$err:=QG_SetSelection (xGrid;0;$cells)
ASSERT($err=qg_noErr)
   // Clear the user selection.

C_LONGINT($err)

$err:=QG_SetSelection (xGrid;0)
ASSERT($err=qg_noErr)

Related commands

QG_GetSelection Get the currently selected grid cells
QG_SetSelectionOptions Set the user selection options for a QGrid area