SetRow method (DataWindows)
Description
Sets the current row in a DataWindow control or DataStore.
Controls
DataWindow type |
Method applies to |
---|---|
PowerBuilder |
DataWindow control, DataWindowChild object, DataStore |
Web |
Client control, server component |
Web ActiveX |
DataWindow control, DataWindowChild object |
Syntax
[PowerBuilder]
1 |
integer <span>dwcontrol</span>.<span>SetRow</span> ( long <span>row </span>) |
[Web DataWindow client control and Web ActiveX]
1 |
number <span>dwcontrol</span>.<span>SetRow</span> ( number <span>row</span> ) |
[Web DataWindow server component]
1 |
short <span>dwcontrol</span>.<span>SetRow</span> ( long <span>row</span> ) |
Argument |
Description |
---|---|
dwcontrol |
A reference to a DataWindow control, |
row |
The row you want to make current |
Return Values
Returns 1 if it succeeds and –1 if an error occurs.
If row is less than 1 or greater than the number
of rows, SetRow fails.
If any argument’s value is null, in PowerBuilder
and JavaScript the method returns null.
Usage
SetRow moves the cursor to the current
row but does not scroll the DataWindow control or DataStore.
Events
SetRow can trigger these events:
-
ItemChanged
-
ItemError
-
ItemFocusChanged
-
RowFocusChanged

Never call SetRow in the ItemChanged event
or any of the other events listed above. Because SetRow can
trigger these events, such a recursive call can cause a stack fault.
Examples
This statement sets the current row in dw_employee
to 15:
1 |
dw_employee.<span>SetRow</span>(15) |
This example unhighlights all highlighted rows, if
any. It then sets the current row to 15 and highlights it. If row
15 is not visible, you can use ScrollToRow instead
of SetRow:
1 |
dw_employee.SelectRow(0, false) |
1 |
dw_employee.<span>SetRow</span>(15) |
1 |
dw_employee.SelectRow(15, true) |