unit rangedlg;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ComCtrls, ExtCtrls;

type
  TRangeDialog = class(TForm)
    TrackBar1: TTrackBar;
    Label1: TLabel;
    Bevel1: TBevel;
    Button1: TButton;
    Button2: TButton;
    procedure FormCreate(Sender: TObject);
    procedure TrackBar1Change(Sender: TObject);
  private
    { Private declarations }
  public
    Function Execute(Var Range: Integer): Boolean;
  end;

var
  RangeDialog: TRangeDialog;

implementation

{$R *.dfm}

function TRangeDialog.Execute(var Range: Integer): Boolean;
begin
 If Range < 0 then range := 0;
 If Range > 5000 then range := 5000;
 Trackbar1.Position := Range;
 Result := Showmodal = mrOK;
 If Result then begin
  Range := Trackbar1.Position;
 end;
end;

procedure TRangeDialog.FormCreate(Sender: TObject);
begin
 trackbar1.SetTick(0);
 trackbar1.SetTick(250);
 trackbar1.SetTick(500);
 trackbar1.SetTick(750);
 trackbar1.SetTick(1000);
 trackbar1.SetTick(1250);
 trackbar1.SetTick(1500);
 trackbar1.SetTick(1750);
 trackbar1.SetTick(2000);
 trackbar1.SetTick(2250);
 trackbar1.SetTick(2500);
 trackbar1.SetTick(2750);
 trackbar1.SetTick(3000);
 trackbar1.SetTick(3250);
 trackbar1.SetTick(3500);
 trackbar1.SetTick(3750);
 trackbar1.SetTick(4000);
 trackbar1.SetTick(4250);
 trackbar1.SetTick(4500);
 trackbar1.SetTick(4750);
 trackbar1.SetTick(5000);
end;

procedure TRangeDialog.TrackBar1Change(Sender: TObject);
begin
 Label1.caption := 'Value: ' + IntToStr(Trackbar1.Position);
end;

end.
