fgl_dialog_setcursor()

The fgl_dialog_setcursor() function sets the cursor at a defined position in the current field.

This function takes as its argument an INTEGER value which is the position at which the cursor should be placed within the current field.

If you specify a cursor position greater than the length of the variable, the cursor will disappear.

In the example below, after clicking the input field in the form and pressing the ACCEPT button, the buffer value will be assigned to the field; cursor will be placed to the position defined by i; the cursor position will be displayed in the message line.

MAIN

DEFINE

i INTEGER,

rec1 RECORD

f1 char(20),

f2 char(20)

end record

OPEN WINDOW w1 WITH FORM "fgl_dialog_setcursor_function"

INPUT BY NAME rec1.* WITHOUT DEFAULTS

      

      ON KEY (ACCEPT)

      IF INFIELD(F1) THEN

              LET i = 3

              CALL fgl_dialog_setbuffer("123456789")

              CALL fgl_dialog_setcursor(i)

              MESSAGE "Cursor pos: ", i

      END IF

      IF INFIELD(F2) THEN

              LET i = 5

              CALL fgl_dialog_setbuffer("987654321")

              CALL fgl_dialog_setcursor(i)

              MESSAGE "Cursor pos: ", i

      END IF

END INPUT

CLOSE WINDOW w1

END MAIN

example form code

DATABASE FORMONLY

SCREEN

{

[f1                       ]

[f2                       ]

}

ATTRIBUTES

f1=FORMONLY.f1;

f2=FORMONLY.f2;

INSTRUCTIONS

SCREEN RECORD s_rec (

      FORMONLY.f1,

      FORMONLY.f2

      )

DELIMITERS "[]"

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.