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:

Wolfram Research (2017), FieldCompletionFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/FieldCompletionFunction.html.

Text

Wolfram Research (2017), FieldCompletionFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/FieldCompletionFunction.html.

CMS

Wolfram Language. 2017. "FieldCompletionFunction." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/FieldCompletionFunction.html.

APA

Wolfram Language. (2017). FieldCompletionFunction. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FieldCompletionFunction.html

BibTeX

@misc{reference.wolfram_2024_fieldcompletionfunction, author="Wolfram Research", title="{FieldCompletionFunction}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/FieldCompletionFunction.html}", note=[Accessed: 22-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_fieldcompletionfunction, organization={Wolfram Research}, title={FieldCompletionFunction}, year={2017}, url={https://reference.wolfram.com/language/ref/FieldCompletionFunction.html}, note=[Accessed: 22-November-2024 ]}