Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with track and progress bars

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
Help im new to delphi and im haveing trouble with 2 things
1: How do i make a trackbar as u move it increase the value in an edit box..
2: how do u make a progress bar when my app starts count to 100

thanks for your help

thank you
 
For item 1) you will need to make conversions from integer to string.

For the second item

1)Drop a timer component on the form
2)Drop a progressbar
3)Drop a button {for test purpose}
4)determine a global integer i

Determining the startup conditions {formactivate}
1) Disable the timer

Starting the timer {button1click}
1) i<-- 0
1) enable timer

[c] timer firing
1) increase i
2) advance progressbar
3) test if i reached the maximum of the progressbar, and disable it when true


Translated to Delphi:


Code:
type
  TForm1 = class(TForm)
    Timer1: TTimer;
    ProgressBar1: TProgressBar;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure FormActivate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  i : integer;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
 timer1.Enabled := true;
 i:=0;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
 inc(i);
 Progressbar1.position := i;
 if i = progressbar1.Max then progressbar1.Enabled := false;
end;

procedure TForm1.FormActivate(Sender: TObject);
begin
 timer1.Enabled:= false;
end;

end.

I hope this will guide you with your application


Regards

S. van Els
SAvanEls@cq-link.sr
 
I come with the source-code for the 1st problem... :p

procedure TForm1.TrackBar1Change(Sender: TObject);
begin
edit1.Text:=intToStr(trackBar1.Position);
end;

Have fun :)
(Look ! I've posted a reply ! Yeeeeee !)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top