Skip to content

pbMultipleSelection - cCJGrid

Determines if multiple rows may be selected

Type: Property
Access: Read/Write
Data Type: Boolean
Parameters: None

Syntax

Property Boolean pbMultipleSelection
Access Type Syntax
Read Access: Get pbMultipleSelection to BooleanVariable
Write Access: Set pbMultipleSelection to BooleanVariable/Value

Description

pbMultipleSelection determines if a single row or multiple rows can be selected. This property is only applied when pbSelectionEnable is True. If pbMultipleSelection is false, the default, only a single row is selected. When True, multiple rows can be selected. pbMultiSelectionMode determines whether the selected items are retained when the grid is scrolled and other rows are displayed.

Don't confuse row selection with the datasource object's SelectedRow function. The SelectedRow is the current row or the row that has the focus. A row selection is a row that happens to be selected or highlighted. Often the SelectedRow and the row selection will be the same. If multi-selection is allowed, this will clearly not be the case.

You should only use multiple selection with grids that have all of their data statically loaded. This would apply to cDbCJGrids that have their pbStaticData property set True. Other types of grids with cached data will lose the selections as data is cached in and cached out.

SetIndexesForSelectedRows sets the row's selection state to True for all row values passed in the SelectedRowIndexes array.

SetSelectedRow allows you to clear or select a row under program control.

SetSelectedRowsAll allows you to clear or select all rows under program control.

If you wish to process selected rows, you can call the function GetIndexesForSelectedRows. This returns an array of selected rows where each row represents a row in your datasource array.

Set pbSelectionEnable to True
Set pbMultipleSelection to True
Set pbStaticData to True
:

Procedure ProcessSelectionItems
    Integer[] SelRows
    Integer i iSels iRow
    String sName
    Handle hoDataSource
    tDataSourceRow[] MyData

    Get GetIndexesForSelectedRows to SelRows
    Get phoDataSource to hoDataSource
    Get DataSource of hoDataSource to MyData
    Move (SizeOfArray(SelRows)) to iSels
    For i from 0 to (iSels-1)
        Move SelRows[i] to iRow
        Move MyData[iRow].sValue[1] to sName
        Showln sName
    Loop
End_Procedure

See Also

pbSelectionEnable | pbStaticData | GetIndexesforSelectedRows | tDataSourceRow