Skip to content

Text input

The text input is an ordinary field where the operator types right on the screen, with no separate window. Typical uses:

  • a batch number or a recipe name;
  • the shift’s names;
  • a downtime comment;
  • a numeric setpoint.

While the field is not focused it shows the tag value. While the operator types, new tag values do not overwrite the edit.

Keys and focus:

  • Enter writes the text to the tag.
  • Esc cancels the edit.
  • Leaving the field (a click elsewhere, Tab) also writes by default. With “Write” set to “Only on Enter”, leaving cancels the edit.

What the tag gets:

  • A string tag gets the text as is.
  • A numeric tag gets a number; both comma and dot work.
  • A wrong number is not sent to the server, and the operator sees an error.

Other properties:

  • “Placeholder” is grey text in an empty field.
  • “Length, characters” limits the input.
  • “Hide input” shows dots instead of characters, for access codes.

Writing checks the element’s right, asks the “Confirm” question and raises “Value changed”.

For numeric setpoints with input limits, units and format, a value field with input is more convenient.

Besides the properties of every element — name, position, size, tooltip, rotation, transparency and the operate right:

Property Values Default Description
Tag tag name Tag
Placeholder text Placeholder. Grey text while the field is empty: “Batch number”
MaxLength integer 0 Length, characters. Maximum text length; 0 — no limit
Password true / false false Hide input. Dots instead of characters — for access codes
Commit EnterOrLeave, Enter EnterOrLeave Write. On Enter and when leaving the field, or only on Enter
Confirm text Confirmation. Question before writing; empty — no question
FontFamily text Font. Windows font name: Segoe UI, Arial, Consolas, Tahoma; empty — default
FontSize number 14 Font size
Bold true / false false Bold
Italic true / false false Italic
Underline true / false false Underlined
Foreground #RRGGBB Text color. Empty — default
Alignment Left, Center, Right Left Alignment
VerticalAlignment Top, Center, Bottom Center Vertically
Background #RRGGBB #FFFFFF Background. Empty — default
BackgroundStyle Solid, VerticalGradient, HorizontalGradient, Transparent Solid Background fill. Solid, gradient (3D) or transparent
Background2 #RRGGBB Second background color. For gradient; empty — lighter than background
BorderColor #RRGGBB #5C646C Border color. Empty — default
BorderWidth number 1 Border width. 0 — no border
BorderStyle Solid, Dash, Dot, DashDot Solid Border style
CornerRadius number 0 Corner radius
Padding number Padding. From border to text; empty — default
Shadow true / false false Shadow
FlashBackground true / false false Flash background. Background alternates with the flash color; to switch by tag — use property animation
FlashBackgroundColor #RRGGBB #D32F2F Background flash color
FlashForeground true / false false Flash text
FlashForegroundColor #RRGGBB #FFFFFF Text flash color
FlashRate Slow, Medium, Fast Medium Flash rate

Item.Type = TextInput. Any property is read and changed by name: Item.Foreground = "#D32F2F". The common element members (Visible, Enabled, Value, Raise, Apply…) are described in Elements from scripts.

Actions of this element:

Member Description
CurrentText The tag value as text
SetText(text) Write text as if the operator typed it and pressed Enter

Mouse, hover, focus and keyboard — as for any element (see Events and functions). Its own events:

  • Value change (Change) — The operator entered a new value.

Write a batch number from a script, as if the operator typed it and pressed Enter.

Screen.Items("Batch").SetText("B-" + new Date().getFullYear() + "-017");

Check the input in the field’s “Value changed” event.

var text = Screen.Items("Batch").CurrentText;
if (!/^B-\d{4}-\d{3}$/.test(text))
HMI.ShowMessage("Batch number format: B-2026-017");