Jump to content

How do I use ShowProgress if the total value is over 10?


eduardosuruagy

Recommended Posts

Hi,

you can use like this. But in this time you will get 100 requests from clientside to update progressbar. So it is not suitable for web apps. 

 

procedure TMainForm.UniButton1Click(Sender: TObject);
var
  i: Integer;
begin
  ShowProgress('Please Wait...');
  UniSession.Synchronize;

  for i := 1 to 100 do
  begin
    Sleep(500);
    UpdateProgress(i, Format('%%%d Completed', [i]));   
    UniSession.Synchronize;
  end;
  HideProgress;
  ShowToast('Process Finished');
end;

 

Link to comment
Share on other sites

26 minutes ago, Hayri ASLAN said:

Hi,

you can use like this. But in this time you will get 100 request from clientside to update progress. So it is not suitable for web apps. 

 


procedure TMainForm.UniButton1Click(Sender: TObject);
var
  i: Integer;
begin
  ShowProgress('Please Wait...');
  UniSession.Synchronize;

  for i := 1 to 100 do
  begin
    Sleep(500);
    UpdateProgress(i, Format('%%%d Completed', [i]));   
    UniSession.Synchronize;
  end;
  HideProgress;
  ShowToast('Process Finished');
end;

 

I wish if the total was 1000 progress would show from 1 to 100%

if it was 10,20,30,500 or etc. progress showed from 1 to 100%

Link to comment
Share on other sites

2 hours ago, eduardosuruagy said:

I wish if the total was 1000 progress would show from 1 to 100%

If I understand you correctly, for example like this:

procedure TMainForm.UniButton1Click(Sender: TObject);
var
  i: Integer;
begin
  ShowProgress('Please Wait...');
  UniSession.Synchronize;

  for i := 1 to 200 do
  begin
    Sleep(500);
    UpdateProgress(i/200, Format('%%%f Completed', [(i*100)/200]));
    UniSession.Synchronize;
  end;
  HideProgress;
  ShowToast('Process Finished');
end;

 

Link to comment
Share on other sites

1 hour ago, Sherzod said:

If I understand you correctly, for example like this:


procedure TMainForm.UniButton1Click(Sender: TObject);
var
  i: Integer;
begin
  ShowProgress('Please Wait...');
  UniSession.Synchronize;

  for i := 1 to 200 do
  begin
    Sleep(500);
    UpdateProgress(i/200, Format('%%%f Completed', [(i*100)/200]));
    UniSession.Synchronize;
  end;
  HideProgress;
  ShowToast('Process Finished');
end;

 

That's right, but it's still showing 0.5 in 0.5. Can you show from 1% to 1%?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...