View Single Post
  #1  
Old 09-08-2016, 21:49
buttignol's Avatar
buttignol buttignol is offline
Registered User
 
Join Date: Sep 2012
Location: Brasil
Posts: 126
Thanks: 102
Thanked 16 Times in 13 Posts
buttignol is on a distinguished road
Help function ProgressPercent

Help function ProgressPercent

I'm trying to use function ProgressPercent

But it works only > LabelPct.Caption: = IntToStr (ProgressPercent) + '%';

I wanted to add + chr (48 + OveralPct mod 10) + '%' '.';

failing to add is not correct (Example: stay like 45.4%)

Can anyone help

Quote:
function ProgressPercent:Integer;
var
pr,i1,i2: Extended;
begin
if (ISDoneProgressBar.Position>ISDoneProgressBar.Min) then begin
i1:=ISDoneProgressBar.Position-ISDoneProgressBar.Min;
i2:=ISDoneProgressBar.Max-ISDoneProgressBar.Min;
pr:=i1*100/i2;
Result:=Round(100*pr/100);;
end;
end;

function ProgressCallback(OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAn siChar): longword;
begin
if OveralPct<=ISDoneProgressBar.Max then
ISDoneProgressBar.Position := OveralPct;

LabelPct.Caption := IntToStr(ProgressPercent)+'.'+chr(48 + OveralPct mod 10)+'%';
LabelCurrFileName.Caption := MinimizePathName(ExpandConstant('{app}\')+CurrentF ile, LabelCurrFileName.Font, LabelCurrFileName.Width);
LabelTime1.Caption := ExpandConstant('{cm:ElapsedTime} ')+TimeStr2;
LabelTime2.Caption := ExpandConstant('{cm:RemainingTime} ')+TimeStr1;
LabelTime3.Caption := ExpandConstant('{cm:AllElapsedTime}')+TimeStr3;
Result := ISDoneCancel;
end;
Thank you
Reply With Quote
Sponsored Links