FieldCompletionFunction

FieldCompletionFunction

is an option for InputField that specifies a function to apply to the input field's contents to generate a list of completions.

Details

  • The default value of FieldCompletionFunction->Automatic indicates that there will be no completion menu for the input field.
  • When a field completion function is specified, the front end will call the function with the current contents of the InputField. If the result of calling the function is a List, then the front end will display the elements of the list in a completion popup menu, which is typically positioned immediately below the input field.
  • If the completion function returns an empty list, no menu will be displayed.
  • The completion function will be called after every keystroke, even if ContinuousAction->False has been set.

Examples

open allclose all

Basic Examples  (2)

Create an input field that offers a fixed set of completions:

Use a completion function that modifies the existing input:

Applications  (2)

Create an input field that offers filename completions:

Create an input field that offers completions of all matching System` functions:

Possible Issues  (1)

A completion function that returns one item will not work if it is not wrapped in a list:

The solution is to simply wrap it in a list:

Introduced in 2017
 (11.1)