Reputation: 13
Using the help of the following youtube video http://www.youtube.com/watch?v=ePuCsvwoHMo I would like to get a progress bar moving (progressing) on button click with ZERO Delphi experiences.
I am trying based on google search and stackoverflow past, similar, questions but with no luck. What should this single line of code (or maximum two) look like and where do I type it?
The second question that is unrelated to first one is:
Is there any website (web application) where I can use Delphi online - actually on the website?
Upvotes: 1
Views: 7483
Reputation: 108929
Create a new VCL project. Drop a TButton
and a TProgressBar
on the main form. Now, double-click the button, and write
ProgressBar1.StepBy(1)
Now you can move the progress bar by repeatedly clicking the button.
If you want the progressbar to move by itself, then you need a TTimer
, so drop one such onto the main form. Set its Enabled
property to false
, using the Object Inspector. Also, set Interval
to 60
. Now, double-click the timer, and write
ProgressBar1.Position := (ProgressBar1.Position + 1) mod ProgressBar1.Max;
Go back to your form, and double-click the button. Remove the code you wrote earlier, and write, instead,
Timer1.Enabled := not Timer1.Enabled;
Now run your project. You can toggle the animation (run, stop) using the button.
Upvotes: 12