Script for Locating and Selecting an Entry in a Browselist or Subfile by Positioning the Cursor

RAMP-NL

Script for Locating and Selecting an Entry in a Browselist or Subfile by Positioning the Cursor


Sometimes entries in browselists/subfiles are selected by positioning the cursor on the desired row and pressing Enter.

To position the cursor in a desired row/column you can use the provided SETCURSOR() interface. Please refer to <setcursor> to find out details of the uses of SETCURSOR().

SETCURSOR receives a row, column and row offset position. The latter is the row number of the first entry in the browselist/subfile. Note that newlook's Data Grids counts the column headings as rows. To find out the row position of a browselist or subfile, run the application in green screen mode until you reach the desired list. You should be able to see the row/column positions on the bottom right of the screen. Move the cursor until the column heading's top most piece of text. That will be the row offset value to pass.

var strCompare = objListManager.VisualId1[0];

/* This is the row number where the first row entry in the list. Column headings are counted as rows */

var intListOffset = 3;

var flagPageDown = true;

while (flagPageDown)

{

 intRowCount = GETVALUE("uuDataGrid.RowCount");

 for (var intRowNo = 0; intRowNo < intRowCount; intRowNo++)

 {

 /* The value we want to compare with is in the first cell */

      if ( GETVALUE("uDataGrid.Rows(" + intRowNo + ").Cells(0).Text") == strCompare)

      {

         SETCURSOR(intRowNo, 10, intListOffset);

         SENDKEY(KeyEnter);

         flagPageDown = false;

         break;

      }

 }

   if (flagPageDown)

   {

      if (GETVALUE("uDataGrid.Marker") != "") SENDKEY(KeyPageDown);

      else { flagPageDown = false; alert("page down is false"); }

   }

}