[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'ComCtrls' (#lcl)

# TTrackBar

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

TTrackBar: a device which allows the user to determine the value of a variable using a quasi-analog slider

## Declaration

Source position: comctrls.pp line 1731

`type TTrackBar = class(TCustomTrackBar)`
`published`
`property Align;` |  | Used to align the control to the top, bottom, left or right of its client.
`property Anchors;` |  | The set of anchor definitions for this control
`property BorderSpacing;` |  | Determines the border spacing for this control
`property Constraints;` |  | Determine Constraints (max and min height and width) for this control
`property DragCursor;` |  | DragCursor - the style of cursor to be used during the Drag process
`property DragMode;` |  | DragMode - whether manual or automatic
`property Enabled;` |  | Whether the control is Enabled. If not, it usually appears 'greyed-out'
`property Frequency;` |  | Frequency - how frequently the position of the slider is to be read and updated (currently unsupported)
`property Hint;` |  | Hint - a small informative pop-up box that appears when the mouse 'hovers' over a control
`property LineSize;` |  | Line-Size - increment for slider position when an arrow key is pressed
`property Max;` |  | Max - the value corresponding to full movement of the slider. Default = 10
`property Min;` |  | Min - the value associated with the minimum slider position. Default = 0
`property OnChange;` |  | OnChange - action to be taken on change in the slider position
`property OnChangeBounds;` |  | Event handler for a change in bounds of the control
`property OnClick;` |  | Event Handler for mouse click
`property OnContextPopup;` |  | Event handler to supply information when a context-sensitive pop-up menu is required
`property OnDragDrop;` |  | Event handler for the Drag-Drop manoeuvre
`property OnDragOver;` |  | Event handler for the case when a control is dragged over another control
`property OnEndDrag;` |  | Event handler for the end of a dragging process
`property OnEnter;` |  | OnEnter - event handler for when the mouse enters the control, and the control receives focus
`property OnExit;` |  | OnExit - event handler for when the mouse leaves the control and it loses focus
`property OnMouseDown;` |  | Event handler for when a mouse button is pressed down
`property OnMouseEnter;` |  | Event handler for when the mouse enters the area of the current control
`property OnMouseLeave;` |  | Event handler for when the mouse leaves the area of the current control
`property OnMouseMove;` |  | Event handler for mouse movement within the current control
`property OnMouseUp;` |  | Event handler for when the mouse button is released, ie "up"
`property OnMouseWheel;` |  | OnMouseWheel - event handler for a movement of the mouse wheel
`property OnMouseWheelDown;` |  | OnMouseWheelDown - event handler for downward movement of mouse wheel
`property OnMouseWheelUp;` |  | OnMouseWheelUp - event handler for upward movement of mouse wheel
`property OnKeyDown;` |  | OnKeyDown - event handler for instance when key is down while control has focus
`property OnKeyPress;` |  | OnKeyPress - event controller for a key being pressed while the control has focus. To properly handle national chars use UTF8KeyPress instead.
`property OnKeyUp;` |  | OnKeyUp - event handler for instance when a key is up (not pressed) while the control has focus
`property OnResize;` |  | Event Handler for resize of control
`property OnStartDrag;` |  | Event handler for start of dragging process
`property OnUTF8KeyPress;` |  | UTF8KeyPress - event controller for a key being pressed while the control has focus.
`property Orientation;` |  | Orientation - horizontal or vertical
`property PageSize;` |  | PageSize - increment for slider position when PageUp or PageDown key is pressed
`property ParentShowHint;` |  | ParentShowHint - does the control adopt the same hinting behaviour as its parent? Default is true
`property PopupMenu;` |  | PopupMenu - a context-sensitive menu that pops up when the right mouse button is clicked over this control
`property Position;` |  | Position - the location of the slider along the track bar. Represents the Return value from the control
`property ScalePos;` |  | ScalePos - whether scaling label appears at top, bottom, left or right
`property ShowHint;` |  | Flag to determine: Is hint to be displayed for this control?
`property TabOrder;` |  | The place this control occupies in the list of tabs
`property TabStop;` |  | Is the control in the sequence of controls accessed by successive presses of the Tab key?
`property TickMarks;` |  | Tickmarks - whether the ticks are above/left, below/right, or both
`property TickStyle;` |  | TickStyle - none, produced automatically, or calculated manually
`property Visible;` |  | Visible - can the control be seen?
`end;`

## Inheritance

`TTrackBar` |  | TTrackBar: a device which allows the user to determine the value of a variable using a quasi-analog slider
`TCustomTrackBar` |  | TCustomTrackBar - the base class for TTrackBar
`TWinControl`
?
`TObject`

## Description

TTrackBar: a device which allows the user to determine the value of a variable using a quasi-analog slider

The device looks like a slider-potentiometer control on a hi-fi amplifier, and consists of a slider which can be moved along a bar using the mouse. Tick marks can be displayed along one or both edges, giving an indication of the proportion of the maximum value of the controlled variable that is being selected.

The Position property indicates the distance along the bar that the slider has been placed, either by the program or by mouse capture and movement

In the example, movement of the slider is detected and shown in the associated TProgressBar.

## See also

HowToUseStdCtrls |  | How to use StdCtrls, ComCtrls or ExtCtrls

## Example

    procedure TForm1.TrackBar1Change(Sender: TObject);
    begin
      ProgressBar1.Position := (TrackBar1.Position)*10
    end;

The latest version of this document can be found at lazarus-ccr.sourceforge.net.