eduardosuruagy Posted August 12, 2019 Share Posted August 12, 2019 How do I use ShowProgress if the total value is over 10? Can do a test with the folder example C: \ Program Files (x86) \ FMSoft \ Framework \ uniGUI \ Demos \ Desktop \ ShowProgress and change the total value from 10 to 100 for example. Link to comment Share on other sites More sharing options...
Hayri ASLAN Posted August 12, 2019 Share Posted August 12, 2019 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 More sharing options...
eduardosuruagy Posted August 12, 2019 Author Share Posted August 12, 2019 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 More sharing options...
Sherzod Posted August 12, 2019 Share Posted August 12, 2019 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 More sharing options...
eduardosuruagy Posted August 12, 2019 Author Share Posted August 12, 2019 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 More sharing options...
Sherzod Posted August 12, 2019 Share Posted August 12, 2019 1 minute ago, eduardosuruagy said: That's right, but it's still showing 0.5 in 0.5. Can you show from 1% to 1%? Sorry, I do not understand what you want. Link to comment Share on other sites More sharing options...
eduardosuruagy Posted August 12, 2019 Author Share Posted August 12, 2019 4 minutes ago, Sherzod said: Sorry, I do not understand what you want. The way you did it puts progress like this: 1%, 1.5%, 2%, 2.5%, ..., 10%, 10.5%, up to 100% I wanted it to be from 1%, 2%, 3% ... 10% to 100% without having the decimal place, got it? Link to comment Share on other sites More sharing options...
Sherzod Posted August 12, 2019 Share Posted August 12, 2019 2 minutes ago, eduardosuruagy said: without having the decimal place, got it? Well, it's elementary. UpdateProgress(i/200, Format('%%%d Completed', [Round((i*100)/200)])); Link to comment Share on other sites More sharing options...
eduardosuruagy Posted August 12, 2019 Author Share Posted August 12, 2019 7 minutes ago, Sherzod said: Well, it's elementary. UpdateProgress(i/200, Format('%%%d Completed', [Round((i*100)/200)])); Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now