![]() |
Help - Progress Percents
Can I add one more decimal in progress percents?
1.1% --> 1.13% Like In Black Box v2 |
start reading here in this topic, few posts / pages, shows how it should be.
http://fileforums.com/showpost.php?p...&postcount=220 |
Quote:
Quote:
|
use this function
Function NumToStr(Float: Extended): String; Begin Result:= Format('%.2n', [Float]); StringChange(Result, ',', '.'); while ((Result[Length(Result)] = '0') or (Result[Length(Result)] = '.')) and (Pos('.', Result) > 0) do SetLength(Result, Length(Result)-1); End; /////////////////////////////////////////////////Example///////////////////////////////// function ProgressCallback(OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAn siChar): longword; var Remaining: Integer; begin if OveralPct<=Wizardform.ProgressGauge.Max then Wizardform.Progressgauge.Position := OveralPct; Result := ISDoneCancel; with WizardForm.ProgressGauge do begin WizardForm.Caption:='Installing - <<{#AppName}>>'; if OveralPct>0 then begin WizardForm.Caption:='Installing - <<{#AppName}>>'+(' Wait:' + TimeStr1); end; if WizardForm.ProgressGauge.Max <> 0 then WizardForm.StatusLabel.Caption :='Unpacking Archives ' + NumToStr((WizardForm.ProgressGauge.Position * 100) / WizardForm.ProgressGauge.Max) + '%'; WizardForm.FilenameLabel.Caption :=' Extracting File: '+ MinimizePathName(CurrentFile, WizardForm.FilenameLabel.Font, WizardForm.ProgressGauge.Width-ScaleX(80)); end; end; |
It gives whole number not two decimals
http://s28.postimg.org/jyg5tiwql/Untitled.jpg |
Quote:
Quote:
Code:
'+IntToStr(OveralPct div 10)+'.'+chr(48 + OveralPct mod 10)+'%';Code:
'+IntToStr(OveralPct div 10)+'.'+chr(48 + OveralPct mod 10)+''+chr(48 + OveralPct mod 5)+'%';maybe this help you |
This convert progress %age to
Quote:
I like this way in Black Box v2 It give Quote:
|
did you try my example in ansi or unicode?
|
yes
Quote:
|
Quote:
|
Quote:
|
use this updated function
Function NumToStr(Float: Extended): String; Begin Result:= Format('%.2n', [Float]); StringChange(Result, ',', '.'); while ((Result[Length(Result)] = '0') or (Result[Length(Result)] = '.')) and (Pos('.', Result) > 0) do SetLength(Result, Length(Result)-1); End; /////////////////////////////////////////////////Example///////////////////////////////// function ProgressCallback(OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAn siChar): longword; var Remaining: Integer; x1, x2: extended; begin x1:=Wizardform.Progressgauge.Position; x2:=Wizardform.Progressgauge.Max; if OveralPct<=Wizardform.ProgressGauge.Max then Wizardform.Progressgauge.Position := OveralPct; Result := ISDoneCancel; with WizardForm.ProgressGauge do begin WizardForm.Caption:='Installing - <<{#AppName}>>'; if OveralPct>0 then begin WizardForm.Caption:='Installing - <<{#AppName}>>'+(' Wait:' + TimeStr1); end; if WizardForm.ProgressGauge.Max <> 0 then WizardForm.StatusLabel.Caption :='Unpacking Archives ' + NumToStr((x1 * 100) / x2) + '%'; WizardForm.FilenameLabel.Caption :=' Extracting File: '+ MinimizePathName(CurrentFile, WizardForm.FilenameLabel.Font, WizardForm.ProgressGauge.Width-ScaleX(80)); end; end; |
This gives
1.1% ---> 11% means no decimal. Tested in unicode. |
lol, then there is something that I am not doing right. i used the same approach with the R.G. Mechenics script, will look through it.
|
i used another format for that now i forget that what i did.
let me check my source first. |
| All times are GMT -7. The time now is 03:52. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
FileForums @ https://fileforums.com