Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 295
  • Last Modified:

ProgressBar while opening a form.

I need to know how I can display progress in the progressbar while the user is opening a Form.
The form contains database data and it takes 15 sec to load. I want the progressbar to tell the user how much is left for the form to show.

thanx Yngvi Thor
 
0
yngvi
Asked:
yngvi
  • 2
  • 2
  • 2
  • +2
1 Solution
 
yngviAuthor Commented:
Adjusted points to 150
0
 
erajojCommented:
Hi,
You have to provide more info.
The way to do it is probably using a thread.
How can you get progress from the DB form? I.e. how do you know what record you're on and how many there are?

/// John
0
 
MadshiCommented:
Yngvi,

I guess the 15 seconds come from what you do in FormCreate, or am I wrong?

procedure RefreshProgressBar(percent: integer);
begin
  ...
end;

procedure FormThatTakes15secToOpen.FormCreate(Sender: TObject);
var i1       : integer;
    progress : integer;
begin
  progress:=0;
  for i1:=0 to 999 do begin
    inc(progress);
    RefreshProgressBar;
    ... // don't know what you're doing that takes 15 sec.
        // I'm not familiar with database programming...
  end;
  for i1:=0 to 999 do begin
    inc(progress);
    RefreshProgressBar(progress*100 div 2000);
    ...
  end;
end;

Hope this helps, Madshi.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
333Commented:
Hi,
can't you use DBProgress component from RxLibrary?

A.
0
 
sakyaCommented:
Hello.

Would you like a code as follows?

--------------------------------------------
procedure TForm1.FormCreate(Sender: TObject);
var
 i: integer;
begin
 Form2 := TForm2.Create(Application);
 Form2.Show;
 Form2.Update;
 for i := 0 to 100 do
 begin
  { your procedure }
  Form2.Gauge1.Progress := i;
 end;
 Form2.Release;
end;
-------------------------------------

Form2 has the Gauge.
You must change Form2  to a selective form.

Sakya


0
 
erajojCommented:
I wonder sometimes why I bother helping people here, when EVERYBODY else have soo much more to offer and are soo much better at formulating it.

/// John
0
 
yngviAuthor Commented:
Thank you very much...

This informtion gave me an idea that helped me to complete the progress bar.. Also a special thanx to Madshi who gave an excellent comment.

Yngvi Thor.
0
 
MadshiCommented:
John, don't worry. Just keep on going...   :-)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now