InsertRow  LineCount

Chapter 9: Methods for the DataWindow Control

IsSelected

Description

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

Syntax

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

Returns

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, 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

Example 1

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

Example 2

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





Copyright © 2004. Sybase Inc. All rights reserved. LineCount

View this book as PDF