IsSelected

Description

Determines whether a row is selected in a DataWindow or DataStore. A selected row is highlighted using reverse video.

Applies to

DataWindow type

Method applies to

PowerBuilder

DataWindow control, DataWindowChild object, DataStore object


Syntax

PowerBuilder

boolean dwcontrol.IsSelected ( long row ) 

Argument

Description

dwcontrol

A reference to a DataWindow control, DataStore, or child DataWindow

row

A value identifying the row you want to test to see if it is selected


Return value

Returns true if row in dwcontrol is selected and false if it is not selected. If row is greater than the number of rows in dwcontrol or is 0 or negative, IsSelected also returns false.

If any argument's value is null, in PowerBuilder and JavaScript the method returns null.

Usage

You can call IsSelected in a script for the Clicked event to determine whether the row the user clicked was selected.

Examples

This code calls IsSelected to test whether the current row in dw_employee is selected. If the row is selected, SelectRow deselects it; if it is not selected, SelectRow selects it:

long CurRow
boolean result
 
CurRow = dw_employee.GetRow()
result = dw_employee.IsSelected(CurRow)
 
IF result THEN
      dw_employee.SelectRow(CurRow, false)
ELSE
      dw_employee.SelectRow(CurRow, true)
END IF

This code uses the NOT operator on the return value of IsSelected to accomplish the same result as the IF/THEN/ELSE statement above:

integer CurRow
boolean result
CurRow = dw_employee.GetRow()
dw_employee.SelectRow(CurRow, &
      NOT dw_employee.IsSelected(CurRow))

See also

SelectRow