The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,860 other subscribers

delphi – How to have both VCL and FMX in one application? – Stack Overflow

Posted by jpluimers on 2026/03/18

From a long while back, but I forgot to add it as a blog post.

The answer to [Wayback/Archive] delphi – How to have both VCL and FMX in one application? – Stack Overflow (thanks [Wayback/Archive] Gad D Lord for asking and [Wayback/Archive] Aleksey Timohin for commenting) is actually straightforward so Gad wrote a blog post on it back then [Wayback/Archive] MTG Studio: How to create and application which compiles both for Firemonkey and VCL.

It follows my answer closely, so here it is:

What about doing it the other way around:

  • start with a FireMonkey application
  • add the OS X platform target
  • IFDEF it so that you can chooise between VCL or FireMonkey

It is not that hard to do this for a 1-form project, then add all the existing stuff from your current VCL dpr.

This might actually lead you to be able to figure out how the .dpr and .dproj of VCL and FireMonkey differ (I tried once, but it was too much to do in a short term way, so I shelved it for future research).

Note:

Be very careful when putting IFDEF in your DPR files. The Delphi IDE owns DPR files, and will remove the IFDEFS, for instance when you add new forms or change some project properties.

The last comment is slightly being alleviated by Delphi XE5 and newer (but I still lost bits of code in more recent versions), hence the comment by Aleksey:

Just a little note. While earlier Delphi versions performed complete cleanup of IFDEFs in .dpr file’s uses block on adding file, the Delphi XE5 version operates more gently, and does not touch IFDEFs for other units.

–jeroen

Leave a comment

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