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 some bugs which needed workarounds, but I must confess half the time I was blaming FMX for my own mistakes or lack of understanding.
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 GestureManager only picks up swipes if they are very horizontal, most people swipe on a slight diagonal. Tab transitions couldn’t be easier. The pinch and zoom code I lifted straight from the sample app that ships with Delphi. Animations are a piece of cake, as are effects, like the ShadowEffect. FMX’s layout system, alignment, and control parenting is extremely flexible making light work of the UI.
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.
If you are not a Delphi developer, I recommend Flutter for mobile development.
I would be very happy to use Delphi on a mobile project.