FMX.GridExplorer Sample
This sample demonstrates how to build a simple file browser using the TGrid and TTreeView components of FireMonkey.
Contents
Location
You can find the GridExplorer sample project at:
- Start | Programs | Embarcadero RAD Studio Athens | Samples and then navigate to:
CPP\Multi-Device Samples\User Interface\GridExplorer
- Subversion Repository:
- You can find C++ code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version.
Description
The GridExplorer sample demonstrates how to build a simple file browser using FireMonkey.
The top bar of the sample application allows you to select a folder. You can either write a path manually and press Enter, or use the ellipsis button to select a folder from a file browser dialog box.
When you open a folder:
- The left-hand sidebar shows a tree view with the folder that you opened. You can use the tree view to recursively navigate its subfolders.
- The main view is a grid that shows information about the files in the selected folder (file name, size, and so on).
When you click a folder in the tree view, the grid shows the files of the clicked folder.
How to Use the Sample
- Navigate to the location given above and open
GridExplorer.cbproj
. - Select a target platform in the Projects Window.
- Press
F9
or choose Run > Run.
Files
File | Contains |
---|---|
|
The project itself. |
|
The main form. |
Classes
TFrmMain
is the main form that represents the main window of the sample. It contains the following components:
- A TScaledLayout object that contains:
- A TRectangle object, which contains a TEdit control, which contains a TSpeedButton control.
- A TTreeView control.
- A TGrid control.
- A TOpenDialog dialog.
Implementation
The GridExplorer sample application uses:
- TScaledLayout for the layout of the main form.
- A TOpenDialog dialog to let users select a folder path.
- A TTreeView control to show a folder hierarchy.
- A TGrid control to show data about the files within a folder.
- TDirectory to navigate the file system.