buttignol
09-08-2016, 21:49
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
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
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
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