Skip to content

SelectedColumn - cCJGrid

Returns the currently selected column - the selected column within the SelectedRow

Type: Function
Return Data Type: Integer

Syntax

Function SelectedColumn Returns Integer

Call Example

Get SelectedColumn to IntegerVariable

Description

SelectedColumn returns the focus column Id.

A grid maintains a selected row and a selected column within the selected row. The selected row is maintained by the datasource object because the datasource must keep itself synchronized with external data (such as files and data dictionaries). Therefore, the SelectedRow function is a datasource function. The selected column is maintained by the grid and therefore SelectedColumn is a cCJGrid function.

SelectedColumn returns a column Id. The column Id is created when the grid column is created and its number represents its index in the data source array. If there is no selected column, SelectedColumn returns -1.

If the column focus is not supported (pbFocusSubItems is false), SelectedColumn returns -1. If there is no SelectedRow (-1), SelectedColumn will be -1.

You can determine the SelectedColumn's column object calling the ColumnObject function.

Get SelectedColumn to iCol
If (iCol<>-1) Begin
    Get ColumnObject iCol to hoCol
End

You can also attain the SelectedColumn object more directly with SelectedColumnObject.

Get SelectedColumnObject to hoCol

You do not select the SelectColumn directly. Instead, you change the selected column via user navigation or by sending one of the navigation methods (MoveToColumnObject, MoveToFirstEnterableColumn, MoveToLastEnterableColumn).

Return Value

The column Id of the current selected column.