INPUT /  OUTPUT /  LANGUAGE





input tag

Presentation tag

Displays a box in which the user can type a line of text.

Sample usage

Fields

Primary field

Scalar field

The text in the box. Reading the input tag generates what the user has typed; assigning to it changes the text in the box.

Secondary fields

Behaviour

The contents of an input box are always text, even if they look like a number. Use num to convert them before calculating with them.

A common pattern is to send the contents to the program and then clear the box:

<name:input onKeyDown=<if <eq key, 13> then=<putLn name>, <name.clear>>> <button {OK} onClick=<putLn name>, <name.clear>>

Notes

If code runs on every keystroke (for example in onInput), the console's busy state can flicker while the user types. Print <console.busy false> to turn it off.

An input box holds a single line of text. For several lines, use a box with editable=true, a fixed size and scroll=true.

See also