This method defines the items for auto-completion options for a field that has been defined with the COMPLETER attribute.
setCompleterItems(
opt DYNAMIC ARRAY OF STRING)
opt specifies the list of the auto-completion options.
DEFINE comp_list DYNAMIC ARRAY OF STRING
MAIN
DEFINE rec RECORD
field1 STRING,
field2 STRING
END RECORD
CALL fill_names()
OPEN WINDOW w WITH FORM "completer" ATTRIBUTE(BORDER)
OPTIONS INPUT WRAP
INPUT BY NAME rec.* ATTRIBUTES(UNBUFFERED)
ON CHANGE field1
CALL fill_proposals(DIALOG, rec.field1)
END INPUT
END MAIN
FUNCTION fill_names()
DEFINE i INTEGER
LET i=0
LET comp_list[i:=i+1] = "One"
LET comp_list[i:=i+1] = "Two"
LET comp_list[i:=i+1] = "Three"
LET comp_list[i:=i+1] = "Four"
LET comp_list[i:=i+1] = "Five"
LET comp_list[i:=i+1] = "Six"
LET comp_list[i:=i+1] = "Seven"
END FUNCTION
FUNCTION fill_proposals(dlg, curr_val)
DEFINE dlg ui.Dialog, curr_val STRING
DEFINE curr_set DYNAMIC ARRAY OF STRING,
i, x INTEGER
LET x=0
FOR i=1 TO comp_list.getLength()
IF upshift(comp_list[i]) MATCHES upshift(curr_val)||"*" THEN
LET curr_set[x:=x+1] = comp_list[i]
END IF
END FOR
CALL dlg.setCompleterItems(curr_set)
END FUNCTION