IsSelected method (DataWindows)
Description
Determines whether a row is selected in a DataWindow or DataStore.
A selected row is highlighted using reverse video.
Controls
|
DataWindow type |
Method applies to |
|---|---|
|
PowerBuilder |
DataWindow control, DataWindowChild object, DataStore |
|
Web ActiveX |
DataWindow control, DataWindowChild object |
Syntax
[PowerBuilder]
|
1 |
boolean <span>dwcontrol</span><span>.IsSelected</span> ( long <span>row </span>) |
[Web ActiveX]
|
1 |
boolean <span>dwcontrol</span><span>.IsSelected</span> ( number <span>row </span>) |
|
Argument |
Description |
|---|---|
|
dwcontrol |
A reference to a DataWindow control, |
|
row |
A value identifying the row you want |
Return Values
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:
|
1 |
long CurRow |
|
1 |
boolean result |
|
1 |
|
1 |
CurRow = dw_employee.GetRow() |
|
1 |
result = dw_employee.<span>IsSelected</span>(CurRow) |
|
1 |
|
1 |
IF result THEN |
|
1 |
dw_employee.SelectRow(CurRow, false) |
|
1 |
ELSE |
|
1 |
dw_employee.SelectRow(CurRow, true) |
|
1 |
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:
|
1 |
integer CurRow |
|
1 |
boolean result |
|
1 |
CurRow = dw_employee.GetRow() |
|
1 |
dw_employee.SelectRow(CurRow, & |
|
1 |
NOT dw_employee.<span>IsSelected</span>(CurRow)) |