Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
Delphi

Writing Software for Multiple Platforms and Architectures with FireMonkey

When developers think about Delphi or C++Builder, the power of the Visual Component Library (VCL) is typically the first thing that comes to mind. If there is a factor that has been instrumental to the success of both Delphi and C++Builder, it is without a doubt the VCL.

The VCL is by far the best way to write desktop applications for Microsoft Windows. Regardless of language or company affiliation, there is no doubt that when it comes to Windows software development, nothing beats the VCL.

But developers today are not limited to just the Windows platform.


Above: Data by StatCounter – gs.statcounter.com – CC-BY-SA 3.0 Unported license

Enter FireMonkey

FireMonkey (FMX) is not just a modernization of the VCL, but rather a completely separate and unique framework for building multi-platform applications. It shares some architectural ideas that helped make the VCL a success, but beneath the surface it’s a completely different engine. One that was written from scratch to be platform independent.

FMX is by far one of the best “write once, deploy everywhere” software development system on the market, and that’s not hype. The impressive list of success stories and businesses created with Embarcadero technology has merit to spare.


Above: Delphi offers a lot of powerful functions, such as Livebindings (see picture above), that simplify and speed up software development. FireMonkey was designed to operate with these features out of the box, both for desktop and mobile applications.

GPU powered graphics

One of the more unique features of FMX is how it deals with graphics.

Instead of relying solely on the host operating-system to deal with the user-interface, FMX was designed to tap into the GPU (graphical processing unit, a vital part of modern graphics cards and architectures) and potentially render the user-interface on its own.
But FMX is not limited to this approach alone.

It can also tap into the underlying operating system, both desktop and mobile, so that your applications seamlessly integrate with the platform look and feel. It uses platform services to adapt the behavior to the current platform. Additionally, certain controls, like the text edit box, can be rendered by the platform OS instead of with the FireMonkey style engine. This guarantees that your application behaves in a way that is consistent with the expectations of your customers.

3D operations

One thing that is completely unique for FMX, is that it embraces 3D graphics by design. Most frameworks have a distinct separation between 2D graphics and 3D graphics, with the latter traditionally isolated in a separate framework or companion package.

Since FMX has 3D graphics built into its very core, all visual components can be positioned in 3D space. You can skew, rotate, scale and perform a variety of graphics operations and filters on the user-interface itself.


Above: Since FMX has 3d as one of its core design principles, writing 3D capable software in Delphi and C++Builder is a lot easier than with other software development systems.

You might wonder what possible benefits 3d could bring to a business application, but intrinsic support for 3D operations on framework level can hold tremendous value for data presentations and reporting. It also simplifies the task of delivering a vibrant, modern and responsive user interface experience for Embedded and IoT applications.

And of course, it gives you an edge when it comes to multimedia and entertainment software.

Service Oriented Architecture

The VCL framework that Delphi and C++Builder is famous for, was designed to interface directly with Microsoft Windows. One of the architectural strengths of the VCL, is the lack of abstraction between the Delphi components and the underlying WinAPI.
The obvious weakness in that formula is the VCL is intimately bound to Microsoft WIndows.

FMX on the other hand, relies on abstraction; thrives even. Under FMX you approach common operating-system features through a series of service interfaces; interfaces that shields you from the underlying complexities and implementation, which by nature will be different from system to system.
This type of approach allows us to unify the underlying technology, diverse as they undoubtedly are, so that developers can focus on their tasks and not waste days, weeks or months re-inventing the wheel.

For example, accessing a camera on Mac OS, iOS or Android will naturally involve different API or library calls. The overall approach is undoubtedly similar, but code written for iOS will never work on Android. Nor can you expect code written specifically for Windows to operate under Linux. It is these distinct differences that FMX neatly abstracts away, leaving you with a an easy to use interface that delivers the exact same functionality for all supported targets.

In short: you write code that interacts with these service interfaces (which is an integral part of the FMX codebase), and FireMonkey deals with the rest.


Above: FireMonkey abstracts away the underlying operating-system’s way of doing things, and offers you a clean path that is universal. Meaning that the same functionality will be available regardless of target. Source: FMXExpress

Platform diversity

Before we continue, let’s have a look at the platforms you can target with FireMonkey today.

Embarcadero provides support for the most popular mobile and desktop platforms out of the box. And by simply adding the FMXLinux package from GetIt (free with your license!), FMX is extended with Linux desktop capabilities (Enterprise and Architect editions of Delphi support the Linux platform for server applications without the FMXLinux addition).

Platform   Architecture
Microsoft Windows   Intel / AMD x86
Apple macOS   Intel / AMD x86
Linux   Intel / AMD x86
Apple iOS   ARM
Google Android   ARM

The important part to remember here, is that Delphi and C++Builder allows you to have a single codebase, yet compile for all of these platforms. In other words you write your program and business logic once, and from that you generate executables for all of them.

Android IoT and Embedded development

The support for Android is of special interest. Prior to Android P, embedded and IoT software written for Android was deployed on a special version of the operating system (Android Things). Without getting into the nitty-gritty, Android Things was a trimmed down version of Android that could run on small devices, everything from a wristwatch to a Raspberry PI. But unless you needed to access low-level APIs (e.g Kernel level functions), the only benefit the system had was it’s Kiosk mode (the ability to run one Android application in full-screen. See below for a more in-depth explanation).

By the time Android P came out, Android Things had fallen out of favour. Those that needed to target small ARM devices pivoted to Google’s WearOS. Since Android P also supports Kiosk mode, IoT developers were better off using the full distribution.

From the time Android Things was released and until Android P hit the market, the power of readily available, affordable and over the counter IoT computers had more than quadrupled.

Android Things was popular when the Raspberry PI 3b was considered powerful. Today you can pick up a board 6 times faster for less than $80 (the Hardkernel ODroid N2 is my favorite board. It comes with a fast 8 core CPU, 4 Gb of ram, Bluetooth, eMMc interface, and twice as many GPIO ports as the Raspberry PI series). The average speed of these mini computers is now well into the x86 range.

This means that the standard Android distribution which runs on most ARM based IoT devices, can be used to write some amazing IoT systems using Delphi. Both visual and service apps.

Kiosk mode

One of the features that was previously only available through the embedded version of Android, is kiosk mode. Configuring a device for kiosk mode means that you can tell Android to only run your FireMonkey application.

In other words, Android will boot up as normal, start its essential services – and once the boot process is complete, your application will be executed.


Above: FireMonkey is a powerful framework, and it brings with it the full power of Delphi and Object Pascal. Making Kiosk applications in FMX for Android is easy and straightforward. Using Delphi for this line of work is a great boon, especially since you can use libraries and third party components that cut down on development time.

In Kiosk mode, your application will run in full-screen and have complete control over the visual display. The exit and home button which is standard for Android is either disabled or limited (this behavior can be configured. Some situations might call for two applications to run simultaneously, so that the user can switch between only those two).

This opens for some very powerful and lucrative opportunities. From information booths to ticket stalls, point of sale systems (POS), inventory automation – to multimedia and advertising systems.

Delphi in particular is very popular in the medical industry where data processing, security and journaling is very important. Expanding such systems with custom hardware, or offering secondary products like appointment kiosk stands – is a natural growth of your portfolio.

And it can all be done using Delphi!

Know 2BrightSparks’ SyncBackPro and how this tremendously nifty tool can help you synchronize and back up data across multiple operating systems.

Linux for IoT

One of the more exciting developments for the FMX platform, is that you can now target Linux! There is a wide variety of x86 powered IoT boards (single board computers) that are powered by standard x86 processors. Both Delphi and C++Builder produce code that is highly efficient for both Intel and AMD based architectures, so you can pick boards from either camp based on performance, memory and affordability.

Out of the box Delphi allows you to write service applications and command-line tools for Red Hat and Ubuntu based Linux distributions; while these two distributions are the most popular, and the only officially supported, the reality is it supports most Linux distributions. Linux is one of the most popular, if not THE most popular operating system for hosting servers and services, and companies can cut costs by moving their existing services to Linux.


Above: Most IoT boards support Linux and Android. But with x86 IoT boards like the Atomic PI, you can use FMX to write services in the exact same way as you would for Microsoft Windows. If you add a UI package, you can move your entire back-end and front-end to affordable IoT technology without much work involved.

As mentioned briefly earlier in this article, you can expand Delphi and with FMXLinux (free with your Delphi license), which allows you to write visual desktop applications too. It integrates completely with the IDE and FMX framework, you can use the exact same components that you would use for Microsoft Windows or Apple macOS. It literally is just a re-compile to bring your products to Linux!

This is especially interesting for IoT and Embedded devices, since using Linux as a foundation represents a significant saving on licenses. You also have full control of deployment since you can configure Linux from top to bottom for your product; including GPIO (general purpose IO pins, used by boards to communicate and control secondary hardware).

Take FMX for a spin!

If you are presently looking at Delphi or C++Builder for a project, then why not take it for a spin? Download a trial edition today or register for the Community edition!

Delphi has been around for 25 years and has a track-record that is hard to match, both for service work, desktop work – and lately, IoT and Linux work!

I think you will discover that Delphi has a lot to offer. There are components for just about everything you can think of, cutting costs and saving precious development time! When you combine that with the power of Interbase, you are in for a smooth development experience from prototype to implementation; testing to deployment.

Also make sure you visit dedicated FMX websites that offer components, tips & tricks, such as the excellent FMXExpress.


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES