FMX.GridExplorer Sample

From RAD Studio Code Examples
Jump to: navigation, search

This sample demonstrates how to build a simple file browser using the TGrid and TTreeView components of FireMonkey.

Location

You can find the GridExplorer sample project at:

  • Start | Programs | Embarcadero RAD Studio Rio | 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.

GridExplorer.png

How to Use the Sample

  1. Navigate to the location given above and open GridExplorer.cbproj.
  2. Select a target platform in the Projects Window.
  3. Press F9 or choose Run > Run.

Files

File Contains

GridExplorer.cbproj
GridExplorer.cpp

The project itself.

MainForm.h
MainForm.cpp
MainForm.fmx

The main form.

Classes

TFrmMain is the main form that represents the main window of the sample. It contains the following components:

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.

Uses

See Also