FireMonkey vs. VCL

Posted by on in Blogs

Frequently when I am talking about the VCL or FireMonkey I get some of these common questions:

  • Is VCL deprecated?
  • Which is better FMX or VCL?
  • If I am starting a new app today, should I use VCL or FMX?

VCL vs. FireMonkey

The first is easy to answer, the other two are a little harder. The VCL (or Visual Component Library) is NOT deprecated, nor will it be any time soon. As long as there is Windows and the Windows API, there will be VCL. Just recently in Marco’s Windows 10 Webinar he said “VCL is the best library for Windows desktop development and fully embraces Windows 10.

The VCL gets new components, features and bug fixes frequently, but maybe not as often as FireMonkey. The reason is the VCL is a mature framework, while FireMonkey has been going through a lot of growth the past few versions (although it has stabilized a lot recently, and is reaching a more mature status.)

So which is better, and which to use? There isn’t a straightforward answer, but instead I can tell you the advantages of each, and you can make an educated choice for your next project.

Visual Component Library (VCL)

Visual Component Library (VCL)

The VCL was released with the first version of Delphi. It is mostly a thin wrapper over the Windows API controls, but also includes a lot of owner draw controls. It uses GDI, Windows Handles and Windows Messages. This makes it subject to the same behavior as 90% of the other windows applications out there. If you want to you can inject a VCL button from your app into another Windows app, or sniff messages sent to a different app and redirect them into yours.

As I said earlier, the VCL is mature, and so is the 3rd party component space. There are thousands of high quality VCL components, controls and libraries out there. Probably the most notable are the grids. The VCL grids are the best in the industry, and for good reason, our technology partners were making grids for the VCL before any other platforms had the idea of 3rd party controls. So if you want the best grid on the planet, you will probably use the VCL (although the FireMonkey grids are gaining fast).

Because VCL is mostly a thin wrapper on the Windows API, VCL based applications are much smaller than FireMonkey applications. Anymore this usually isn’t a huge deal with fast download speeds and huge hard drive sizes. But if you need a really small lightweight application, then VCL might be a good choice.

Because VCL has been around a while, you may have some existing VCL code that you want to integrate into your application. You could use a utility like Mida converter to convert it to FireMonkey, or something like Monkey Mixer or TFireMonkeyContainer to mix FireMonkey with VCL.

Generally if I am building a simple grid intensive application that I know will only run on Windows, then I find myself using VCL. Or if I need to leverage a specific 3rd party control, or Windows API feature that requires Windows messages. This is less and less frequent though.


FireMonkey Cross Platform Framework (FMX)

FireMonkey FMX

As FireMonkey is a newer framework you tend to see it covered more. A lot of people are still learning how to use it, and how to tackle cross platform development. The main advantage of FMX is that it is designed from the ground up to be a cross platform framework. It lets you design a single user interface that runs and looks great on Windows, iOS, macOS and Android. But that isn’t the only reason to use FireMonkey.

FireMonkey is based on the latest GPU frameworks: DirectX for Windows and OpenGL elsewhere. It supports both 3D and 2D rendering models, both of which are hardware accelerated. If you want to have some powerful graphic effects or 3D, then FireMonkey is probably going be your first choice. There are some really powerful 3D engines as well as some great graphics effects libraries for VCL, but FireMonkey has these ideas baked into it’s core.

FireMonkey is also a lot more flexible. You can embed any control in any other control with FireMonkey. This ability to build composite controls turns the smaller set of controls it includes into a much more robust set of controls. Also there are animations and effects that let you build fantastic, rich user interfaces with very little effort.

VCL has a respectable set of containers and alignments, but FireMonkey has many, many more, and again they are much more flexible. Another big difference is FireMonkey uses a single precision floating point number instead of an integer in laying out the controls. Much higher precision, but typically subpixel precision doesn’t buy you much. Where it does make a difference is when you scale on FireMonkey since it supports multiple pixel densities.

The most obvious reason to use FireMonkey is if you are currently planning to target multiplatform, or there is a possibility you might in the future (which is a pretty high likelihood). The other reasons are you want a more flexible UI or you plan to take advantage of 3D or other effects FireMonkey provides.

Conclusion

In summary VCL is amazing, and continues to get fixes and new features. It is a better user interface framework than any other out there, except maybe FireMonkey. So use VCL when you are only targeting Windows and don’t need the 3D, effects or flexibility of FireMonkey. Use FireMonkey when you are going multiplatform, or you want new some of FireMonkey’s flexibility especially when working around graphics.

Both frameworks will be around for a while. As you use them both you will get a better feel for which to use in each situation. I’d love to hear your feedback about when you choose which framework.



Comments

  • Stormbringer
    Stormbringer Friday, 29 September 2017

    I'm relatively new to this matter, but I build applications for mathematical computations. If I would run an algorithm for 10 minutes with mostly array transformations, would VCL be significantly faster than FireMonkey?

  • Absa Lootly
    Absa Lootly Friday, 29 September 2017

    VCL and FireMonkey are just methods of handling the display of your application. You could also opt to use neither if you wanted a console application.

    The underlying code would run at the same speed in all three scenarios if you take into account any time required for the visual libraries to initialize and finalize.

    The only way there may be a speed increase would be if you were to use the math processing of the video card. There are a number of libraries out there for using CUDA with Delphi and those would probably be your best place to start.

    If you want to show graphs of your results then the VCL may be faster, but it only runs on Windows. If you want to show graphs on multiple platforms, simply by recompiling, then FireMonkey would be the way to go.

  • Stormbringer
    Stormbringer Friday, 29 September 2017

    Such a swift reply! :)

    Good to know that the underlying code is independent. Utilising the video card would be a nice extension of course. Thanks for the info!

  • Michael Thuma
    Michael Thuma Friday, 10 November 2017

    In the most simple case use Codeblocks and the corresponding MINGW provided by the site. You only have to adjust the location where the debugger can be found under settings debugger.

    Not sure if iirc. When passing a double ** matrix it's a pointer in Delphi too and has to be declared in the type section. And don't forget to import with the correct calling convention. (I would have to revisit this topic)

    Delphi is pretty good and flexible concerning this situation.

  • Emanuel F23276
    Emanuel F23276 Friday, 29 September 2017

    Hi Stormbringer,

    I love Embarcadero (a.k.a. Borland), and most of our GUIs are done in VCL. But we're in HPC (very heavy numerical algorithms, taking hours and more even when massively parallelized) and if I can be of any advice, build your computation-heavy code in 64-bit GNU (MinGW-64 runs natively in Windows): you will see at least a two-fold speedup in execution, even compared to the 64-bit CLang offered in the latest Tokyo.
    It's not trivial to do (we have all the number crunching in DLLs), but for us it's really a life saver.

    Good luck!

  • Stormbringer
    Stormbringer Saturday, 30 September 2017

    Wow, thanks for the info Emanuel! I will look into GNU.

  • Pedro R27446
    Pedro R27446 Saturday, 18 March 2017

    fmx is derived from DxScene and VgScene and developped by Eugene Kryokov from Russia and it's works under GPU (which mean The Graphic Card GPU) and here we can say two things one of them is worse and the other is best let start by the worse: when we make an FMX App we can't run it under windows where this one still work without the Real driver of the Display Adapter and still use just the Microsofts windows Display Adapter because unfortunatly our App we can not see it because the render driver is not installed yet .... :) And About the Best : it's the best FrameWork that can let Pascal work on MultiPlatForm . And About VCL i Can't beleive that the same person who can create fireMonkey Yesterday is now going to Create CrossVCL today (Year of 2017) Really the question Now is not About VCL Vs FMX but it is About Russia Vs America or Eugene Kryokov Vs Embarcadero TEAM !!!!!!

  • Emanuel F23276
    Emanuel F23276 Friday, 28 October 2016

    I'd love to be able to build our things for OSX (in particular) without recoding, but honestly, for people like me with 20+ years of VCL (I begun with Borland's Turbo C - probably before most of you were even born) that is STILL IN USE, FM boils down to a single question, namely
    - how to (easily!) translate legacy VCL to FM?
    Now I'm not picky and would be willing to move to FM gradually, for instance creating any new forms in FM and converting the existing one when I have the time... but that begs the second question, namely
    - can FM forms be mixed with VCL forms in the same executable/DLL?

    Thanks for your input!

  • Marcin W11002
    Marcin W11002 Tuesday, 18 October 2016

    So, if FMX uses intensively DirectX or OpenGL, doses it mean that on mobile devices apps consume more power and you have to charge your smartphone or tablet often?

  • Absa Lootly
    Absa Lootly Tuesday, 18 October 2016

    I have not seen this to be true. I have been working on a HD Firemonkey app for 15 months. I cannot say that the 3D would not be more intensive on battery use, but I have not seen a problem from the HD app.

  • Hamid reza K22985
    Hamid reza K22985 Friday, 14 October 2016

    VCL support Right to Left but FM don`t

  • shraga M11650
    shraga M11650 Monday, 17 October 2016

    This is one of the big problem :( .
    We need bidimode too and stay with VCL.
    For andriod application we have to go to anther development environment

  • Barry D4121
    Barry D4121 Thursday, 13 October 2016

    The thing about FireMonkey that really bugs me is that it's so mouse-centric in the IDE. For instance, you have your main form with several controls on it. Click on one, then press F12 to go to the source editor. Then press F12 again. The control you clicked is still selected but it doesn't actually have focus, so if you press Tab, nothing happens; you have to click the control again.
    Also, and this one drives me crazy, click on a control and press Enter. Nothing happens. You have to either click into the Object Inspector or press F11. (And now in the latest 10 builds, pressing F11 sets the focus to the combo box in the Object Inspector, not the grid! So frustrating!)

    In a VCL app if click on a control and press Enter the grid in the Object Inspector gets focus. And if you press Enter again, focus goes right back to the selected control on the form.

    One more quick thing, the IDE Form Designer is not really WYSIWYG. That needs quite a bit of improvement.

  • Frank Lauter
    Frank Lauter Thursday, 13 October 2016

    The Designer is WYSIWYG! You can select the Plattform and you can create Forminheritance for each plattform. On Top you have the visual-live-preview on your physical device.
    What else do you need?

  • Barry D4121
    Barry D4121 Thursday, 13 October 2016

    Often, when you run your app controls aren't aligned where you put them or they're different sizes, etc.

  • Mehrdad E15197
    Mehrdad E15197 Thursday, 13 October 2016

    Be honest! Please tell us when BiDiMode would be supporeted in Firemonkey? it would be or not?

  • Mehrdad E15197
    Mehrdad E15197 Thursday, 13 October 2016

    What about BiDiMode? Andoid is everywhere and FireMoneky is best but without RighT To Left Support we are nothing!!!!

  • Frank Lauter
    Frank Lauter Thursday, 13 October 2016

    I'm using TP since 1.0, Delphi since 1.0 and FMX since XE2.
    Let's forget FMX before XE6 - I call it "learning time". After XE8 you could use FMX for nearly all kind of applications. (Use always the latest Version, especially on mobile!)
    On my workshops for FMX, my advice is : "Every new application should be started with FMX".
    Ok - there are a few parts in the daily use that could be better, but to fill this gap, I have developed my Firemonkey Development Kit (FDK).
    If you keep some rules in mind, like "Do everything in background that is not UI-related", because the UI-Thread and the timers needs their own "core", you'll get an application with UI-Power you've never seen on VCL. (Try your FMX-Application on a windows computer with gamer-graphic-card).

  • Rick Stephens
    Rick Stephens Thursday, 13 October 2016

    Interesting comments. I was going to post an anti-FMX message because I tried hard to use FMX on XE5 and found it to be a useless pile of rubbish. I have rather large VCL desktop applications and shudder at the thought of rewriting merely because FMX exists. In your experience, how does FMX work with SQL Server or MySQL? One of my big problems earlier is that the FMX data aware controls did not work, and no data aware grids existed. I see WollToWoll now has an FMX library, so maybe FMX is a possibility in the future. Meanwhile, I will continue with VCL and my familiar Konopka, Orpheus, and InfoPower controls. (Have been using Pascal since Borland Bascal in the late 80s.)

  • Frank Lauter
    Frank Lauter Thursday, 13 October 2016

    If you last tried FMX with XE5, I can understand your concerns. As I wrode: Forget everthing pre XE8! Try 10.1!
    I never used MSSQL but MySQL is my daily work.

  • Please login first in order for you to submit comments

Check out more tips and tricks in this development video: