Temperaments in FMX

In the programming world the first thing most of us do when trying out a new technology is to write a hello world application. It seems Temperaments has become my hello world app for experimenting with mobile applications. I have two versions in the Play Store already, one written in Xamarin (2015), and another in Flutter (2018). Previously I’d built a desktop application to test Delphi’s FireMonkey framework (FMX), but now I wanted to give it a try on mobile. Time for another Temperaments app 🙂

Overall, the project went well. There are still things to tweak, but I had crossed the bridges I needed to determine that Delphi is indeed capable for mobile development. At times it was frustrating, there were often bugs which needed workarounds.

Below is the basic structure of the application, minus a few classes later added. As typical for Delphi FMX projects, there’s one form and the separate views are swapped in and out as required. A ViewController is responsible for managing the views, which inherit from a TFrame called TView – which provides essential functionality and is the basic abstraction separating a view from a standard frame. Reusable logic was decoupled into classes for future applications.

For the flash cards feature, it was necessary to manually track the user touches in the main form and delegate the identified swipe gestures to the active view. The built in gesture detection only picks up swipes if they are very horizontal, most people swipe on a slight diagonal. Tab transitions needed speeding up. The pinch and zoom was a little tricky to get working. Most animations were a piece of cake, as were the effects, like the ShadowEffect. FMX’s layout system, alignment, and control parenting is extremely flexible.

In fact Delph’s TFrame control and the UI Designer are a nice mechanism for managing reusable UI elements and their associated code. You can then easily compose views from these frames:

One of the big advantages of Delphi is its component oriented approach to development. Alexander’s HTML Component is awesome for rendering documents – fast and native with no dependencies. You can also subscribe to events, such as when a link is touched. The more components you leverage, the higher the quality, and the faster the development.

As mentioned, it wasn’t a bug free experience, but it was a good experience. You most certainly can use Delphi for full-stack development in 2021, especially with frameworks like Delphi MVC Framework and TMS Web Core. For Delphi shops, it is a great option for bringing existing desktop applications to mobile, and leveraging existing skills.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s