Liquid UI - WS Reference Library

setcursor()


Purpose

With setcursor(), you can place the cursor into an inputfield, a table cell or a position on a list of your choice. There are several possible syntaxes for the setcursor command which are as follows:

 

Syntax

Description

setcursor([row,col]); Sets the cursor into a field specified by the included coordinates.
setcursor("F[Name]"); Sets the cursor into a specified inputfield.
setcursor("cell[tableName, col, row]"); Sets the cursor into a specified cell in a table.

When you use setcursor on a table cell, the column can be identified either by the column number or by the column name as in the following examples:

 setcursor("cell[Data Entry Area, 5, 10]");
 setcursor("cell[Data Entry Area, Subobject, 4]");

In addition, the row number can be specified by a variable as in the following example:

znum = 1;
setcursor("cell[Data Entry Area, 3, &V[z_num]]"); 
Note: When used with the table command, the column must always be listed before the row as in the previous example. In addition, the setcursor command will not work for any row other than the first if the table is empty.


Available Options

You can use the following options with the setcursor:

"offset":".."

"offset":x - The offset option will offset the cursor from the left margin of the field in which it will be placed.

Options Detail

offset

  1. The offset option will offset the cursor from the left margin of the field in which it will be placed. This option is mostly used when there are multiple fields in a single row.

  2. setcursor("F[Payment card]",{"offset":20});
  3. As per the code, the cursor is positioned at second field of "payment card",which is at position 20 from the left margin of the field.
Note: The offset option can only be used with a field name and doesn't work with field coordinates and on table cells.


Example

Using setcursor() command with Liquid UI fields

To set the cursor into a Liquid UI field, you must use the field name. Currently using the coordinates is not supported.

On execution, the cursor appears on the 'Price' item field, as shown in the following figure:
 


Script

setcursor("F[Price]"); 

Script Details