Delphi - Fmx Samples
Studying Delphi FMX samples is essential, but blindly copying them leads to bugs. Here are five real-world problems and how to fix them.
Typical folder structure (local install):
FMX/
├── Controls/ # TListBox, TGrid, TTreeView, etc.
├── Data/ # LiveBindings, FireDAC, REST, DB-aware controls
├── Dialogs/ # TFileOpenDialog, TPrintDialog, custom dialogs
├── Drawing/ # Canvas, TBitmap, TPath, TShape
├── Effects/ # TShadowEffect, TGlowEffect, TBlurEffect
├── Gestures/ # TGestureManager, touch gestures
├── Graphics/ # 2D/3D transformations, shaders
├── Layout/ # TLayout, TGridLayout, TFlowLayout
├── Media/ # TMediaPlayer, TCamera, TMicrophone
├── Multi-Device/ # Platform-specific behaviors, conditional compilation
├── Sensors/ # Accelerometer, gyroscope, location
├── Styles/ # Custom style books, dynamic styling
├── 3D/ # TViewport3D, TLight, TModel3D, collision detection
└── Web/ # TWebBrowser, TWebBrowser (embedded Chromium)
Even great samples can be outdated or misused. Watch out for these issues:
// Camera capture with QR detection and 3D augmentation
TCameraOverlay = class
procedure ProcessCameraFrame(Bitmap: TBitmap);
procedure DetectQRAndOverlay3D;
end;
This spectrum analyzer showcases:
The code is ready to compile - just add the necessary FMX components to your form and you'll have an impressive demo that shows off Delphi's multimedia and 3D capabilities! delphi fmx samples
Master Multi-Platform Development: A Deep Dive into Delphi FMX Samples
The promise of "write once, deploy everywhere" has been a developer's dream for decades. In the world of Delphi, this dream is realized through the FireMonkey (FMX)
framework. Unlike the Windows-centric VCL, FMX is a cross-platform powerhouse that allows you to target Android, iOS, Windows, macOS, and Linux from a single codebase.
Whether you are a seasoned Delphi veteran or a newcomer exploring modern cross-platform tools Studying Delphi FMX samples is essential, but blindly
, the best way to learn is through hands-on samples. Here is a curated guide to the most essential Delphi FMX samples and how they can accelerate your development. 1. The "Big 50": A Comprehensive Starter Kit If you are looking for a one-stop shop, the 50 Cross Platform Samples for Delphi
is the gold standard. These samples cover everything from basic UI to advanced hardware integration: UI Fundamentals: Samples like HelloWorldStyled DrawerMenu show you how to use TMultiView for modern navigation drawers. Data Handling: Learn how to bind data to visual controls using LiveBindings ListViewFromJson StringGridWithJsonData Hardware Access:
samples demonstrate how FMX accesses native device APIs directly—often with just a single component. Embarcadero 2. Mastering Modern Mobile UI
Mobile users expect fluid transitions and native-feeling controls. Several key samples focus specifically on these polished experiences: Even great samples can be outdated or misused
Samples frequently use $IFDEF ANDROID or $IFDEF IOS to handle permissions (camera, location, notifications).
Example:
$IFDEF ANDROID
PermissionsService.RequestPermissions(['android.permission.CAMERA']);
$ENDIF
Why you need it: FMX is GPU-accelerated. You can draw thousands of shapes without flicker.
Key sample: CanvasDrawingDemo – draws lines, bezier curves, and custom TPath objects.
Lesson learned: Use BeginScene / EndScene when performing batch drawing. Never call Canvas.DrawLine inside a tight loop without batching.
FMX uses a flexible layout system based on TAlign, TLayout, TGridPanelLayout, and TScaleLayout. Key samples to explore:
| Sample Name | What It Teaches |
|-------------|------------------|
| CustomListBox | Creating dynamic, styled list items |
| MasterDetailDetail | Multi-level navigation on mobile |
| TabControlTransitions | Animated swiping between tabs |
| AdaptiveLayout | Changing UI orientation and size at runtime |
Code highlight – Adding a search filter to a TListView (excerpt from official sample):
procedure TForm1.SearchEditChangeTracking(Sender: TObject);
begin
TListView(SearchHandle).Items.Filter :=
function (Item: TListViewItem): Boolean
begin
Result := ContainsText(Item.Text, SearchEdit.Text);
end;
end;
A sample demonstrating the use of TListView to display a list of items.
program ListViewSample;
uses
System.StartUpCopy,
FMX.Forms,
FMX.Controls,
FMX.Types,
FMX.ListView;
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Form1.ListView1.Items.Add('Item 1');
Form1.ListView1.Items.Add('Item 2');
Form1.ListView1.Items.Add('Item 3');
Application.Run;
end.