View Single Post
  #2  
Old 24-09-2019, 09:01
Carldric Clement's Avatar
Carldric Clement Carldric Clement is offline
Registered User
 
Join Date: Aug 2014
Location: Toboh, Sabah, Malaysia
Posts: 596
Thanks: 599
Thanked 656 Times in 233 Posts
Carldric Clement is on a distinguished road
Quote:
Originally Posted by MaXun View Post
It does not correctly determine the volume of the hard drive and the weight of the game.
Code:
function DelSp(s: string): string;
begin
  while Pos('  ',s)>0 do StringChange(s,'  ',' ');
  Result:=Trim(s);
end;

procedure GroupChange(Sender: TObject);
begin
  GroupEditLabel.Caption := MinimizePathName(WizardForm.GroupEdit.Text, GroupEditLabel.Font, GroupEditLabel.Width);
end;

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;

function MbOrGb(Float: extended): ansistring;
begin
  if Float >= (1024*1024*1024) then
    result:=format('%.2n',[Float/(1024*1024*1024)])+' Gb'
  else
    result:= format('%.2n',[Float/(1024*1024)])+' Mb';
end;

function GetElementIndex(a:TALabel; lbl:TLabel):integer;
var
  i:integer;
  f:boolean;
begin
  Result:=-1;
  f:=False;
  for i:=0 to GetArrayLength(a)-1 do
    if a[i]=lbl then begin
      f:=True;
      Break;
    end;
  if f then Result:=i;
end;

function NoIcons: Boolean;
begin
  Result:= BtnGetEnabled(hGroupBrowseBtn);
end;

function Desktop: Boolean;
begin
  Result:= BtnGetChecked(DesktopCheck);
end;

function QuickLaunch: Boolean;
begin
  Result:= BtnGetChecked(QuickLaunchCheck);
end;

procedure HideControls;
begin
  LabelPct1.Hide;
end;
What is wrong here?
I've just update a little bit. Just copy and paste through it.
Code:
function MbOrGB(Float: extended): ansistring;
begin
  if Float<1024 then Result:=NumToStr(Float)+' MB'
  else if (Float/1024)<1024 then Result:=NumToStr(Float/1024)+' GB'
  else if (Float/(1024*1024))<1024 then Result:=NumToStr(Float/(1024*1024))+' TB'
end;
Reply With Quote
The Following 2 Users Say Thank You to Carldric Clement For This Useful Post:
Celestosapien (05-10-2019), MaXun (24-09-2019)