Results 1 to 7 of 7

Thread: [TUT] Forms: TProgressBars

  1. #1
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default [TUT] Forms: TProgressBars

    Today we will be learning how to use TProgressBars.

    First, create a form that looks like this:


    Without the label at the bottom of course .

    Then, put the below procedure above the InitForm; procedure.

    SCAR Code:
    procedure Increase(Sender : TObject);
    begin
      if x.Position < 110 // Where x is the name of the progress bar.
        x.StepIt;
    end;

    After that, attach the procedure to run when the button is clicked. To do so put

    SCAR Code:
    x.OnClick := @y; // Where x is the name of the button and y is the name of the procedure.

    below where it says

    SCAR Code:
    x.TabOrder := y; // Where x is the name of the button and y is the tab order. You don't have to do anything to that line.

    Then run the form. It should work now and the progress bar should increase by 1/10 of it's size each time you click the button.

    Now let's explain the variables of the progressbar and what they do.

    SCAR Code:
    x := TProgressBar.Create(y);   // x is the name of the progress bar.
      x.Parent := frmDesign          // y is the name of the form it's on.
      x.Left := 16;                  // z is the number the progressbar increases each time
      x.Top := 32;                   // x.StepIt; is called.
      x.Width := 169;                // a is the minium number that the progressbar can go.
      x.Height := 17;                // b is the maximum number the progressbar can go.
      x.TabOrder := 9;               // When StepIt; is called and the position of the
      x.Step := z;                   // progressbar is already at maximum it will go back to
      x.Min := a;                    // the minimum.
      x.Max := b;

    There is also another way to step the progressbar.

    SCAR Code:
    x.StepBy(y); // where x is the name of the progressbar and y is the amount to step by.

    Progressbars can be used to create cool things like download progress bars and are great when combined with TTimers.

    Thank you for reading my tutorial.
    I hoped you learned something from reading it!

    Don't forget to rate the thread 5 stars and rep me if you liked it!

    The script used is attached below.

  2. #2
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    It's a good tut, pretty simple to follow, just as it should be.
    I don't think progress bards are too advanced, it would be nice if this thread stayed where it already is IMO.

    I see you're really good with forms, why not make a massive tutorial that consists of a compilation of tutorials about all kinds of form-related subjects?

  3. #3
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yea maybe I will do that.

  4. #4
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Hey Umm, shouldn't this be in Tutorial Island . Good Tutorial, Get on MSN

  5. #5
    Join Date
    Mar 2006
    Posts
    3,051
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    I would move for you, but if you want to edit it and add more you might not be able to do so in another section. I'll leave it here until you complete it.


  6. #6
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Updated. Added a picture and attached script and made it more detailed.

  7. #7
    Join Date
    May 2008
    Location
    ;)
    Posts
    576
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Oooo Thanks! very helpful, i was looking for a tut on this.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Forms
    By marre in forum OSR Help
    Replies: 2
    Last Post: 12-19-2007, 07:53 PM
  2. Need help with forms!
    By Da Der Der in forum OSR Help
    Replies: 2
    Last Post: 01-14-2007, 07:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •