Search code examples
delphicontrols

How do I show all folders and files in drives C, D, or E in Delphi by using ListView-like control/component?


How can I implement the idea in the pictures in a Delphi project? So that there is a TComboBox to display drives C, D and E with icons, and when choosing a path, all folders and files with icons appear at the bottom. I think it is TListview, so that when I click on a path, its files appear, and when I click on any file, any of its content appear, whether other files or images.

selecting drive from ComboBox

selecting path in list of folders


Solution

  • Those are legacy controls from 16 bit Windows 3.1 - you can find the controls in the tab "Win 3.1". They are:

    • TDriveComboBox,
    • TDirectoryListBox and
    • TFileListBox

    ...all sitting in the Vcl.FileCtrl.pas unit.

    Windows 3.1 legacy controls

    In the properties you have to link each control to the other, so they automatically work together. Here's an example DFM as text, also with a TFilterComboBox:

    object Form1: TForm1
      object dcbDrive: TDriveComboBox
        DirList = dlbFolder
      end
      object dlbFolder: TDirectoryListBox
        FileList = flbFile
      end
      object flbFile: TFileListBox
      end
      object fcbFilter: TFilterComboBox
        FileList = flbFile
      end
    end