| Class TRkTrackBar (unit RkTrkBar) |
TCustomControl
| Constructors |
constructor Create( AOwner : TComponent );| Functions |
destructor Destroy;
function CanChange( NewPos : Integer ) : Boolean;
procedure Change;
procedure DoEnter;
procedure DoExit;
procedure DrawThumb;
procedure DrawTick( Canvas : TCanvas; Location : TPoint;
Index : Integer );
procedure DrawTicks;
procedure DrawTrack;
procedure KeyDown( var Key : Word; Shift : TShiftState );
procedure Loaded;
procedure MouseDown( Button : TMouseButton; Shift : TShiftState;
X, Y : Integer );
procedure MouseMove( Shift : TShiftState; X, Y : Integer );
procedure MouseUp( Button : TMouseButton; Shift : TShiftState;
X, Y : Integer );
procedure Paint;
procedure CMDesignHitTest( var Msg : TCMDesignHitTest );
procedure CMEnabledChanged( var Msg : TMessage );
function CursorPosition : TPoint;
procedure LoadThumbBitmaps;
procedure SetMax( Value : Integer );
procedure SetMin( Value : Integer );
procedure SetOrientation( Value : TTrackOrientation );
procedure SetPosition( Value : Integer );
procedure SetShowTicks( Value : Boolean );
procedure SetThumbSize( Value : TThumbSize );
procedure SetThumbStyle( Value : TThumbStyle );
procedure SetTickStyle( Value : TTickStyle );
procedure SetTrackColor( Value : TColor );
procedure SetTrackWidth( Value : Word );
procedure UpdateDitherBitmap;
procedure WMGetDlgCode(var Msg: TWMGetDlgCode);
procedure WMSetCursor( var Msg : TWMSetCursor );
procedure WMSize( var Msg : TWMSize);| Properties |
property About : TRkAboutInfo
property Color :
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;
FOnChanging : TPositionChangingEvent;
FOnDrawTick : TDrawTickEvent;
FOrientation : TTrackOrientation;
FPageSize : Word;
FPosition : Integer;
FShowTicks : Boolean;
FSliding : Boolean;
FThumbBmp : TBitmap;
FThumbCursor : HCursor;
FThumbHeight : Integer;
FThumbRct : TRect;
FThumbSize : TThumbSize;
FThumbStyle : TThumbStyle;
FThumbWidth : Integer;
FTickStyle : TTickStyle;
FTrackColor : TColor;
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;