All Cadcorp SIS API Methods

MoveCursor Method

Description

Move the current row to a new position by moving it forward or backward by a specific number of rows. Can be used to loop through the rows in a cursor.

Syntax

Visual Basic
Public Function MoveCursor( _
   ByVal cursor As String, _
   ByVal nDelta As Long _
) As Long

Parameters

cursor
The named cursor in which the current row is to be moved.
 
nDelta
The number of lines by which to move the current row. A positive number moves the current position forward; a negative number moves the current position backward (providing the cursor was not opened as forward-only).

Return Type

If the move was successful the return value is nDelta. If the move would place the current row beyond the end of the cursor the return value is 0 and the current row is the last (or first, if moving backward) in the cursor.

The UpdateCursorItem method must be called in order for the return type to acknowledge the end of the cursor when changes to cursor items have been undertaken. Otherwise the return will always be nDelta.

Remarks

Available: GEO D OD OM SISpy

Group:

Dim Count As Integer=-1
Do
 Count = Count + 1
Loop Until sis.MoveCursor ("MyCursor", 1) = 0
sis.MoveCursor ("MyCursor", -Count)

This code counts how many rows there are in MyCursor between the one current initially and the end of the cursor. It does this by moving the current row forward and then moves the current row back to be the one current initially.