TcxCustomTrackBar.Position Property
Specifies the current position of the track bar’s thumb.
Declaration
property Position: Integer read; write; default 0;
Property Value
Type | Default |
---|---|
Integer | 0 |
Remarks
End-users can change the position of the track bar’s thumb (and thus the editor’s edit value) using any of the following methods:
Drag the thumb with the mouse;
Click the track bar at the required position;
Click the change buttons;
Press the arrow keys, or the Page Up, Page Down, Home, or End key when the track bar editor is focused. Pressing any of these keys while holding down the Shift key adjusts the current selection.
When any of these methods are used, the Properties.OnChange event is raised. Thus, you can provide a proper response to changing the edited value. To do so, you will need to obtain the current position of the track bar’s thumb and this is available via the Position property.
You can also use the Position property to change the edited value programmatically. Note that this property value is restricted to the range specified by the Properties.Min and Properties.Max property values. Trying to assign a value below the allowed range will result in setting the Position to the Properties.Min property value. Similarly, assigning a value beyond the range will assign it to the Properties.Max property value. Changing the Position property value programmatically results in raising the Properties.OnChange event.
Setting the Position property programmatically is useful, for instance, when you want to synchronize the track bar editor with another control. An example can be using the track bar editor together with a text editor. In this case, the track bar editor can be used for rough value modifications while the text editor allows precise value changes. This assumes that the text editor’s value changes are handled and the Position property of the track bar editor is modified as needed. The Properties.OnChange event of the track bar editor must also be handled to update the bound control in this case.
The default value of the Position property is 0.