View Single Post
  #404  
Old 08-10-2023, 16:47
BLACKFIRE69's Avatar
BLACKFIRE69 BLACKFIRE69 is offline
Registered User
 
Join Date: Mar 2019
Location: In the Hell
Posts: 688
Thanks: 481
Thanked 2,547 Times in 561 Posts
BLACKFIRE69 is on a distinguished road
Quote:
Originally Posted by hitman797 View Post
but we need to add this function:
System.IOUtils:
Code:
function TDirectory.GetFiles(const Path: string): TStringDynArray;
function TDirectory.GetDirectories(const Path: string): TStringDynArray;
function TDirectory.GetLogicalDrives: TStringDynArray;
TArrayOfString = array of String; in innosetup
ListBox:
Code:
procedure ListBoxItemClick(const Sender: TCustomListBox;
  const Item: TListBoxItem);
Label:
Code:
function GetText: WideString;


i think you may not have noticed that FMXInno has already included these things.


Quote:
Originally Posted by hitman797 View Post
Code:
function TDirectory.GetFiles(const Path: string): TStringDynArray;
Code:
var
  FindHandle: Longint;

begin
  FindHandle := pFindFiles('C:\Test01', '*.*', '', ffrkRelative, True, False);

  if FindHandle <> 0 then
  begin
    WinTB1.Text('Files: ' + IntToStr(pFileCount(FindHandle)));

    try
      for i:=0 to pFileCount(FindHandle)-1 do
        Memo.AddLine(pPickFile(FindHandle, i));
    finally
      pFindFree(FindHandle);
    end;
  end;
end;


Quote:
Originally Posted by hitman797 View Post
Code:
function TDirectory.GetDirectories(const Path: string): TStringDynArray;
Code:
var
  FindHandle: Longint;

begin
  FindHandle := pFindFiles('C:\Test01', '*', '', ffrkRelative, True, True);

  if FindHandle <> 0 then
  begin
    WinTB1.Text('Dirs: ' + IntToStr(pDirCount(FindHandle)));

    try
      for i:=0 to pDirCount(FindHandle)-1 do
        Memo.AddLine(pPickDir(FindHandle, i));
    finally
      pFindFree(FindHandle);
    end;
  end;
end;


Quote:
Originally Posted by hitman797 View Post
Code:
function TDirectory.GetLogicalDrives: TStringDynArray;
Code:
begin
  LogicalDrives.FCreate;

  if LogicalDrives.Count > 0 then
  begin
    for i := 0 to LogicalDrives.Count - 1 do
      Memo.AddLine(LogicalDrives.Letter(i));
  end else
    MsgBox('"LogicalDrives" failded!', mbError, MB_OK);
end;


Quote:
Originally Posted by hitman797 View Post
ListBox:
Code:
procedure ListBoxItemClick(const Sender: TCustomListBox; 
  const Item: TListBoxItem);
Code:
procedure ListBoxOnChange(Sender: TObject);
var
  i: integer;
  TargetLstItm: FListBoxItem;
begin
  if ListBox.GetItemIndex > -1 then
  begin
    for i := 0 to length(ListBoxItems)-1 do
      if Sender = TObject(ListBoxItems[i].GetObject) then
      begin
        TargetLstItm := ListBoxItems[i] as FListBoxItem;
        break;
      end;

    WinTB1.Text(TargetLstItm.GeText);
  end;
end;


ListBox.FCreate(FMXForm.Handle);
ListBox.SetBounds(NSX(32), NSY(53), NSX(297), NSY(249));
ListBox.OnChange(@ListBoxOnChange);
Reply With Quote
The Following 2 Users Say Thank You to BLACKFIRE69 For This Useful Post:
audiofeel (08-10-2023), hitman797 (09-10-2023)