5-Minute Snack: Getting to know FmxLinux…and being amazed!
With Tokyo out of the door and finally having the means again to write server-side code for a Linux system, I will still a bit disappointed not being able to design user-interfaces with Delphi and deploy them to Linux.
Yes, Embarcadero made it crystal clear what their approach towards Linux will be, but I think as we are all enthusiastic about Delphi, we were hoping for some sort of FireMonkey support as well. I still remember setting up KDE for Kylix back in the days…
A couple of days ago my Facebook feed caught a news item about “FmxLinux”. Furthermore, the term got shared over and over again on LinkedIn and thus it triggered my interest. I found out that FmxLinux would extend FireMonkey so that it would support the Linux platform with a Linux system that is running a graphical user environment.
Having already set up a Virtual Machine with Linux for my Delphi server projects, I decided to set up another Desktop-based Linux virtual machine in order to give it a test run.
As Tokyo supports Ubuntu, I chose “Ubuntu Desktop 16.04.2 LTS”:
After downloading the ISO you can follow the steps written by Pawel Glowacki precisely, found here.
I suggest selecting “Auto Login” during install, so that the Desktop is loaded right away without the need to log in. Furthermore, you will need to open “Terminal” in order to type in the commands that Pawel describes in his blog post. Still, they are precisely the same for the Desktop version.
After installing the PAServer, you can start it just the same as on the server version of Ubuntu:
You can see that I used FmxLinux already.
Now to the giant task to install FmxLinux. I expected a lot of work as it is a download of a beta version. Also, my hopes were not up that it would work right out of the box.
I was very wrong!
With a simple click to “Download Free Trial v 0.92” I downloaded an exe file that will install everything into your Delphi environment.
Took me less than a minute.
I started Delphi and created a FireMonkey application. I did not use a template and dropped a TListBox (Info) and a TStatusBar with an embedded TLabel.
I double-clicked the form and entered the following code snippet, adding System.IOUtils to the uses-clause as well:
procedure TForm1.FormCreate(Sender: TObject); begin Info.Items.Add(TPath.GetSharedDocumentsPath); Info.Items.Add(TPath.GetSharedPicturesPath); Info.Items.Add(TPath.GetSharedDownloadsPath); Info.Items.Add(TPath.GetHomePath); end;
I also added an implementation for the MouseMove-event of the form:
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Single); begin Label1.Text := '(' + Trunc(X).ToString + ', ' + Trunc(Y).ToString + ')'; end;
Running the app yields the expected result as 64-bit Windows has been selected by default:
If you want to select Linux as the target platform you will be disappointed. It is impossible. However, with FmxLinux installed you may right-click the Project File in the Project Manager and you will find a context-menu item called “Add Linux platform”. If you already added it before and made changes to your configuration you can even update the platform config using this approach without editing any configuration files manually. FmxLinux offers an “Update Linux platform” action for that.
Again, not expecting much, I double-clicked the Linux platform entry and ran the app.
Wow! It works out of the box, no configuration hassle, nothing.
And investigating the results that are added to the TListBox, even the system-specific aspects work nicely. I point this out because a server system might not have the need for a download directory e.g. The directories I picked are pretty “user-specific”.
Summed up, for a very early Trial version the results are simply amazing.
The maturity of the user-experience is very high. It takes absolutely no effort “what-so-ever” to deploy your application to a Linux Desktop. Once deployed you can run it without the “PAServer” like any other binary on the system.
Next I will try to write a REST Client with data grids and see what the user experience is going to be like. Furthermore, I might try using some FireDAC components..
Kudos to Eugene Kryukov for creating a wonderful product that will open up Delphi to a whole new world of development possibilities.