Embarcadero is focusing their efforts on FireMonkey to the detriment of the VCL, but the consensus among developers is clear: FireMonkey is far from being ready for prime time – on Windows maybe even more so than on the other platforms. At the same time, Microsoft has been aggressively improving its API stack for app development. 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?
Now I'm porting all the project to FireMonkey. TImage32 is not supported there, so I'm thinking now whether it's possible to do the same without any thirt-party controls. FireMonkey looks very powerful and flexible but so far I couldn't find anything like a multi-layered image among its components. Maybe, there's a way to easily build such an image yourself?I want to have a different list of units in the uses
clause depending on compiling for FMX or VCL. In the code below I try to test FireMonkeyVersion
which works in an FMX project (label1.Text
is 'FMX'). When I move the $IF statement into the uses
clause I get an error message ([dcc32 Error] fmx_text.pas(7): E2026 Constant expression expected
). Is there any way to get the desired conditional compilation?
1 Answer
FireMonkeyVersion
is not a compiler-defined value. It is a named constant declared in the FMX.Types
unit instead. Try using {$IF DECLARED(FireMonkeyVersion)}
, eg:
But I don't see a reason to check its numeric value. You either have FireMonkey or you do not:
With that said, do keep in mind that it is possible (though not officially supported) to mix FireMonkey and VCL together in the same project. So you might need to re-think whatever you are trying to accomplish by differentiating the frameworks.