TrackBar
TrackBar (Adjustment Bar)
The TrackBar is a control object that allows the operator to select a value within a predefined Minimum and Maximum range by dragging a slider (thumb) along a “tick” mark system.
Although functionally similar to the HScrollBar, the TrackBar is generally preferred for more user-friendly “adjustment” or “precision” controls (e.g., Volume, Speed settings). It can be configured as either Horizontal or Vertical using a single object.
Basic Configuration and Operation
1. Defining Range and Orientation (Advanced Panel) The object’s operational logic is defined in the Advanced panel.
- Determines whether the object is horizontal or vertical.
- Sets the lowest and highest values the slider can reach.
- Determines the frequency of “ticks” (marks) displayed on the bar.
2. Binding the Value (Properties Panel)
- The value selected by the operator is linked to a SCADA tag via the Value property in the Properties panel.
Properties Panel – Key Properties
Value
- Tag:
- Function: This is a two-way link connecting the slider’s current position (within the Minimum and Maximum range) to a tag.
- Read: If the linked tag (e.g., Motor_Speed) is set to 50 by a script or the PLC, the TrackBar slider automatically moves to the middle position (assuming Min=0 and Max=100).
- Write: If the operator drags the slider to the 75% position (assuming Min=0 and Max=100), the value 75 is written to the Motor_Speed tag.
Advanced Panel – Key Properties
- Orientation
- The Most Important Feature. Determines whether the object is Horizontal or Vertical.
- TickFrequency
- Determines how often ticks are drawn on the bar.
- Example: If Min=0, Max=100, and TickFrequency=20, ticks will appear at points 0, 20, 40, 60, 80, and 100.
- TickStyle
- Determines where the ticks appear relative to the bar (BottomRight, TopLeft, Both, None).
- SmallChange
- The amount the value changes when the operator presses the arrow keys on the keyboard (Usually 1).
- LargeChange
- The amount the value changes when the operator clicks on the empty track area instead of dragging the slider (Usually 5 or 10).
Note: Minimum and Maximum Value Precedence
The TrackBar object allows for defining minimum and maximum limits in two different ways:
- Fixed Values (Advanced Panel):
- The Minimum and Maximum fields in the Advanced tab set a static operating range for the control.
- These are used when a fixed range is required (e.g., 0–100).
- These values do not change during runtime.
- Values Defined via Tag (Properties Panel):
- The Minimum and Maximum fields in the Properties -> Value tab allow the control to retrieve its range dynamically from a tag.
- This ensures the slider automatically updates based on the current value range of the connected variable.
Priority Rule: If both static (Advanced) and Tag-based (Properties) minimum/maximum values are defined, the values coming from the tag take precedence. This ensures the control behaves according to real-time system data.
Common Usage Example
Example: Fan Speed Adjustment (Horizontal, 0-100)
- Add a TrackBar and a Label to the screen.
- Go to the Advanced panel of the TrackBar object:
- Orientation: Horizontal
- Minimum: 0
- Maximum: 100
- TickFrequency: 10 (Show a tick every 10 units)
- TickStyle: BottomRight
- Go to the Properties panel of the TrackBar object:
- Bind Value -> Tag to the Fan_Speed_Setpoint tag.
- Go to the Properties panel of the Label object:
- Bind Value -> Tag to the same Fan_Speed_Setpoint tag (to visualize the exact value).
Result:
- As the operator moves the slider, the Fan_Speed_Setpoint tag takes a value between 0 and 100, and the Label displays this value instantly.
- Conversely, if the PLC writes “25” to this tag, the slider automatically moves to the quarter position.
