The fgl_dialog_getselectionend() function is used to return the position of the last character of the string, selected within the current field.
The function returns an integer value. The function returns zero, if the whole text is selected.
The value returned by the fgl_dialog_getselectionend() function can be higher than that of the fgl_dialog_getcursor() function, if the user performed the selection from right to left.
In the example below, the position of the last character from the selected substring will be displayed in the form message string after a user inputs to the field, selects a substring of the entered data, and presses F2 key.
MAIN
DEFINE
f1 char(25)
OPEN WINDOW w1 WITH FORM "fgl_dialog_getselectionend_function"
INPUT BY NAME f1 WITHOUT DEFAULTS
ON KEY (F2)
MESSAGE "Sel pos: ", fgl_dialog_getselectionend()
END INPUT
CLOSE WINDOW w1
END MAIN
example form code
DATABASE FORMONLY
SCREEN
{
[f1 ]
}
ATTRIBUTES
f1=FORMONLY.f1;
INSTRUCTIONS
SCREEN RECORD s_rec (
FORMONLY.f1
)
DELIMITERS "[]"