Skip to content

Button

A button runs actions on events: a click opens a screen or writes a value, pressing and releasing the left button give a jog command (a bit while the button is held). An action is a list of system functions or a script, with a confirmation question and an operate right.

The look is system, flat or raised, with a picture on the left, top, right, bottom or instead of the text. “Pressed state tag” makes a latching button: while the tag is on, the button looks pressed.

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

Property Values Default Description
Text text Кнопка Label. Several lines — with wrapping («Text wrapping» property)
Style System, Flat, Raised System Button style. System — as in Windows; flat and raised — with your colors, border and rounding
HoverBackground #RRGGBB Hover background. Empty — slightly lighter than background
PressedBackground #RRGGBB Pressed background. Empty — slightly darker than background
PressedTag tag name Pressed state tag. Latching button: while the tag is «on», the button looks pressed (pressed background)
Image image file Image. Image from the project images/ folder on the button
PressedImage image file Pressed image. Own image while the button is pressed or latched
ImagePlacement Left, Top, Right, Bottom, Only Left Image position
ImageSize number Image size. Side in pixels; empty — by button height
Wrap true / false false Text wrapping
FontFamily text Font. Windows font name: Segoe UI, Arial, Consolas, Tahoma; empty — default
FontSize number 13 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 Center Alignment
VerticalAlignment Top, Center, Bottom Center Vertically
Background #RRGGBB 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 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 = Button. Any property is read and changed by name: Item.HoverBackground = "#D32F2F". The common element members (Visible, Enabled, Value, Raise, Apply…) are described in Elements from scripts.

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

The Start button is unavailable until ready — the Operator control enable animation does the same without a script; use a script for a complex condition.

var ready = Tags("Pump1.Ready").Value && !Tags("Pump1.Fault").Value && Tags("Mode").Value === 1;
Screen.Items("Start").Enabled = ready;

Press a button from a script — run its actions as if the operator clicked.

Screen.Items("Acknowledge").Raise("Click");

Highlight the current screen’s button in a navigation bar.

Screen.All().filter(function (e) { return e.Type === "Button" && e.Name.indexOf("Nav_") === 0; })
.forEach(function (b) { b.Bold = b.Name === "Nav_" + Screen.Name; });