Class TRkTrackBar (unit RkTrkBar)

Inherits from

TCustomControl

Constructors


constructor Create( AOwner : TComponent );

=========================} {== TRkTrackBar Methods ==} {=========================


Functions

destructor Destroy;

Create internal bitmap objects

function CanChange( NewPos : Integer ) : Boolean;

========================================================================= TRkTrackBar.

procedure Change;

Indicate focus by drawing dotted box around control

procedure DoEnter;

Allow user to draw custom ticks

procedure DoExit;

When control gets focus, update display to show focus border

procedure DrawThumb;

= TRkTrackBar.

procedure DrawTick( Canvas : TCanvas; Location : TPoint; Index : Integer );

========================================================================= TRkTrackBar.

procedure DrawTicks;

= TRkTrackBar.

procedure DrawTrack;

= TRkTrackBar.

procedure KeyDown( var Key : Word; Shift : TShiftState );

When control loses focus, update display to remove focus border

procedure Loaded;

Release GDI cursor object

procedure MouseDown( Button : TMouseButton; Shift : TShiftState; X, Y : Integer );

= TRkTrackBar.

procedure MouseMove( Shift : TShiftState; X, Y : Integer );


procedure MouseUp( Button : TMouseButton; Shift : TShiftState; X, Y : Integer );

= TRkTrackBar.

procedure Paint;

= TRkTrackBar.

procedure CMDesignHitTest( var Msg : TCMDesignHitTest );

========================================================================= TRkTrackBar.

procedure CMEnabledChanged( var Msg : TMessage );


function CursorPosition : TPoint;

= TRkTrackBar.

procedure LoadThumbBitmaps;

Array Constants hold all bitmap resource names for easy access

procedure SetMax( Value : Integer );

Need to reinitialize the FThumbRct so that the test between FThumbRct and FLastThumbRct fails.

procedure SetMin( Value : Integer );

Update the Position property

procedure SetOrientation( Value : TTrackOrientation );

Update the Position property

procedure SetPosition( Value : Integer );


procedure SetShowTicks( Value : Boolean );

= TRkTrackBar.

procedure SetThumbSize( Value : TThumbSize );


procedure SetThumbStyle( Value : TThumbStyle );

Reload bitmaps if thumb size changes

procedure SetTickStyle( Value : TTickStyle );

Reload bitmaps if thumb style changes

procedure SetTrackColor( Value : TColor );


procedure SetTrackWidth( Value : Word );


procedure UpdateDitherBitmap;

= TRkTrackBar.

procedure WMGetDlgCode(var Msg: TWMGetDlgCode);


procedure WMSetCursor( var Msg : TWMSetCursor );

========================================================================= TRkTrackBar.

procedure WMSize( var Msg : TWMSize);

So TrackBar can process arrow keys

Properties

property About : TRkAboutInfo


property Color :

Inherited Properties & Events

property DragCursor :


property DragMode :


property Enabled :


property HelpContext :


property Hint :


property Max : Integer


property Min : Integer


property Orientation : TTrackOrientation


property PageSize : Word


property ParentShowHint :


property PopupMenu :


property Position : Integer


property ShowHint :


property ShowTicks : Boolean


property TabOrder :


property TabStop :


property ThumbSize : TThumbSize


property ThumbStyle : TThumbStyle


property TickStyle : TTickStyle


property TrackColor : TColor


property TrackWidth : Word


property Visible :


Events

event OnChange : TNotifyEvent


event OnChanging : TPositionChangingEvent


event OnClick :


event OnDragDrop :


event OnDragOver :


event OnDrawTick : TDrawTickEvent


event OnEndDrag :


event OnEnter :


event OnExit :


event OnKeyDown :


event OnKeyPress :


event OnKeyUp :


event OnMouseDown :


event OnMouseMove :


event OnMouseUp :


Variables

FAboutInfo : TRkAboutInfo;


FBackgroundBmp : TBitmap;


FBorderWidth : Integer;


FDitherBmp : TBitmap;


FHalfWidth : Integer;


FLastThumbRct : TRect;


FMaskBmp : TBitmap;


FMax : Integer;


FMin : Integer;


FOnChange : TNotifyEvent;

Internal storage for custom events

FOnChanging : TPositionChangingEvent;


FOnDrawTick : TDrawTickEvent;


FOrientation : TTrackOrientation;


FPageSize : Word;


FPosition : Integer;


FShowTicks : Boolean;


FSliding : Boolean;


FThumbBmp : TBitmap;


FThumbCursor : HCursor;


FThumbHeight : Integer;

Internal storage for Thumb properties

FThumbRct : TRect;


FThumbSize : TThumbSize;


FThumbStyle : TThumbStyle;


FThumbWidth : Integer;


FTickStyle : TTickStyle;


FTrackColor : TColor;

Internal storage for Track properties

FTrackRct : TRect;


FTrackWidth : Word;



Constructors


constructor Create( AOwner : TComponent );

=========================} {== TRkTrackBar Methods ==} {=========================


Functions


destructor Destroy;

Create internal bitmap objects


function CanChange( NewPos : Integer ) : Boolean;

========================================================================= TRkTrackBar.CanChange This is the event dispatch method supporting the OnChanging event. Notice that this method is a function, rather than the common procedure variety. As a function, the Result variable is assigned a value before calling the user defined event handler. =========================================================================


procedure Change;

Indicate focus by drawing dotted box around control


procedure DoEnter;

Allow user to draw custom ticks


procedure DoExit;

When control gets focus, update display to show focus border


procedure DrawThumb;

= TRkTrackBar.DrawTicks =


procedure DrawTick( Canvas : TCanvas; Location : TPoint; Index : Integer );

========================================================================= TRkTrackBar.DrawTick This method is the event dispatch method for the OnDrawTick event. The parameters are: Canvas - The Canvas for the TrackBar Control Location - Point record indicating X or Y coordinates of tick mark Index - Position index of tick mark to be drawn =========================================================================


procedure DrawTicks;

= TRkTrackBar.DrawTrack =


procedure DrawTrack;

= TRkTrackBar.UpdateDitherBitmap =


procedure KeyDown( var Key : Word; Shift : TShiftState );

When control loses focus, update display to remove focus border


procedure Loaded;

Release GDI cursor object


procedure MouseDown( Button : TMouseButton; Shift : TShiftState; X, Y : Integer );

= TRkTrackBar.KeyDown =


procedure MouseMove( Shift : TShiftState; X, Y : Integer );


procedure MouseUp( Button : TMouseButton; Shift : TShiftState; X, Y : Integer );

= TRkTrackBar.MouseMove =


procedure Paint;

= TRkTrackBar.DrawThumb =


procedure CMDesignHitTest( var Msg : TCMDesignHitTest );

========================================================================= TRkTrackBar.CMDesignHitTest Handling this component message allows the TrackBar's thumb to be changed at design-time using the left mouse button. If the mouse is positioned over the thumb or the thumb is already being dragged, then set the Msg.Result value to 1. This instructs Delphi to allow mouse events to "get to" the TrackBar component. =========================================================================


procedure CMEnabledChanged( var Msg : TMessage );


function CursorPosition : TPoint;

= TRkTrackBar.MouseDown =


procedure LoadThumbBitmaps;

Array Constants hold all bitmap resource names for easy access


procedure SetMax( Value : Integer );

Need to reinitialize the FThumbRct so that the test between FThumbRct and FLastThumbRct fails. This ensures that the correct background image is captured when the component is loaded.


procedure SetMin( Value : Integer );

Update the Position property


procedure SetOrientation( Value : TTrackOrientation );

Update the Position property


procedure SetPosition( Value : Integer );


procedure SetShowTicks( Value : Boolean );

= TRkTrackBar.SetPosition =


procedure SetThumbSize( Value : TThumbSize );


procedure SetThumbStyle( Value : TThumbStyle );

Reload bitmaps if thumb size changes


procedure SetTickStyle( Value : TTickStyle );

Reload bitmaps if thumb style changes


procedure SetTrackColor( Value : TColor );


procedure SetTrackWidth( Value : Word );


procedure UpdateDitherBitmap;

= TRkTrackBar.LoadThumbBitmaps =


procedure WMGetDlgCode(var Msg: TWMGetDlgCode);


procedure WMSetCursor( var Msg : TWMSetCursor );

========================================================================= TRkTrackBar.WMSetCursor If the mouse is over the thumb, then change cursor to the custom thumb cursor that resides in the RzTrkBar.res resource file. =========================================================================


procedure WMSize( var Msg : TWMSize);

So TrackBar can process arrow keys


Properties


property About : TRkAboutInfo


property Color :

Inherited Properties & Events


property DragCursor :


property DragMode :


property Enabled :


property HelpContext :


property Hint :


property Max : Integer


property Min : Integer


property Orientation : TTrackOrientation


property PageSize : Word


property ParentShowHint :


property PopupMenu :


property Position : Integer


property ShowHint :


property ShowTicks : Boolean


property TabOrder :


property TabStop :


property ThumbSize : TThumbSize


property ThumbStyle : TThumbStyle


property TickStyle : TTickStyle


property TrackColor : TColor


property TrackWidth : Word


property Visible :


Events


event OnChange : TNotifyEvent


event OnChanging : TPositionChangingEvent


event OnClick :


event OnDragDrop :


event OnDragOver :


event OnDrawTick : TDrawTickEvent


event OnEndDrag :


event OnEnter :


event OnExit :


event OnKeyDown :


event OnKeyPress :


event OnKeyUp :


event OnMouseDown :


event OnMouseMove :


event OnMouseUp :


Variables


FAboutInfo : TRkAboutInfo;


FBackgroundBmp : TBitmap;


FBorderWidth : Integer;


FDitherBmp : TBitmap;


FHalfWidth : Integer;


FLastThumbRct : TRect;


FMaskBmp : TBitmap;


FMax : Integer;


FMin : Integer;


FOnChange : TNotifyEvent;

Internal storage for custom events


FOnChanging : TPositionChangingEvent;


FOnDrawTick : TDrawTickEvent;


FOrientation : TTrackOrientation;


FPageSize : Word;


FPosition : Integer;


FShowTicks : Boolean;


FSliding : Boolean;


FThumbBmp : TBitmap;


FThumbCursor : HCursor;


FThumbHeight : Integer;

Internal storage for Thumb properties


FThumbRct : TRect;


FThumbSize : TThumbSize;


FThumbStyle : TThumbStyle;


FThumbWidth : Integer;


FTickStyle : TTickStyle;


FTrackColor : TColor;

Internal storage for Track properties


FTrackRct : TRect;


FTrackWidth : Word;