Slider
The slider sets a tag value by dragging the knob — from “Minimum” to “Maximum”, rounded to the step. The value is written on release or, with “Write while dragging”, during the movement. Ticks, tick labels and the track, fill and knob colors are configurable. “Confirmation” asks a question before writing, and the Value change event fires after the write.
Properties
Section titled “Properties”Besides the properties of every element — name, position, size, tooltip, rotation, transparency and the operate right:
| Property | Values | Default | Description |
|---|---|---|---|
Tag |
tag name | Tag | |
Minimum |
number | 0 |
Minimum |
Maximum |
number | 100 |
Maximum |
Step |
number | 1 |
Step. The value is rounded to the step; 0 — no rounding |
Orientation |
Vertical, Horizontal |
Horizontal |
Direction |
ShowValue |
true / false |
true |
Show value |
Format |
text | 0.## |
Value format |
WriteWhileDragging |
true / false |
false |
Write while dragging. Write the value while dragging (by step); otherwise — on release |
TrackColor |
#RRGGBB |
#C9CED4 |
Track color |
FillColor |
#RRGGBB |
#2F6FB0 |
Fill color. Track from minimum to thumb; empty — no fill |
ThumbColor |
#RRGGBB |
#FFFFFF |
Thumb color |
ThumbSize |
number | 18 |
Thumb size |
TrackThickness |
number | 6 |
Track thickness |
Ticks |
integer | 0 |
Ticks. Number of scale intervals; 0 — no ticks |
TickLabels |
true / false |
false |
Tick labels |
Confirm |
text | Confirmation. Question before writing; empty — no question | |
FontFamily |
text | Font. Windows font name: Segoe UI, Arial, Consolas, Tahoma; empty — default | |
FontSize |
number | 12 |
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 |
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 | 0 |
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 |
From scripts
Section titled “From scripts”Item.Type = Slider. Any property is read and changed by name: Item.TrackColor = "#D32F2F". The common element members (Visible, Enabled, Value, Raise, Apply…) are described in Elements from scripts.
Actions of this element:
| Member | Description |
|---|---|
SetValue(value) |
Set a value as the operator would — within the limits, by the step, with confirmation and the “Value change” event |
Events
Section titled “Events”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.
Examples
Section titled “Examples”“Normal” and “Eco” buttons set the setpoint the same way the operator does with the slider — within limits, by the step, with the question.
Screen.Items("Setpoint").SetValue(Tags("Mode.Eco").Value ? 65 : 75);Slider limits from tags — the Screen opened event script.
var s = Screen.Items("Setpoint");s.Minimum = Tags("SP.Min").Value;s.Maximum = Tags("SP.Max").Value;A check after a change — the Value change event: the new value is already in Item.Value.
if (Item.Value > 90) HMI.ShowMessage("High setpoint: check the network pressure");