FRAME-INDEX function

During a data entry statement, returns the subscript of the array element of the input field that the cursor is in as an INTEGER value. At other times, returns the subscript of the array element the cursor was in.

The FRAME-INDEX function is particularly useful if you want to provide the user with help for the input array element being edited.

Note: Does not apply to SpeedScript programming.

Syntax

FRAME-INDEX

Example

In this example, the FRAME-INDEX function uses the cursor position to determine which option you have chosen:

r-frindx.p

DEFINE VARIABLE menu AS CHARACTER NO-UNDO EXTENT 3.

DO WHILE TRUE:
  DISPLAY
    "1. Display Customer Data" @ menu[1] SKIP
    "2. Display Order Data"    @ menu[2] SKIP
    "3. Exit"                  @ menu[3] SKIP
    WITH FRAME choices NO-LABELS.
  CHOOSE FIELD menu AUTO-RETURN WITH FRAME choices
    TITLE "Demonstration Menu" WITH CENTERED ROW 10.
  HIDE FRAME choices.
  IF FRAME-INDEX EQ 1 THEN 
    MESSAGE "You picked option 1.".
  ELSE IF FRAME-INDEX EQ 2 THEN 
    MESSAGE "You picked option 2.".
  ELSE IF FRAME-INDEX EQ 3 THEN LEAVE.
END.

Notes

See also

Frame phrase, FRAME-DB function, FRAME-FIELD function, FRAME-FILE function