Delphi – uses controls unit in all versions of Delphi, VCL, FMX

FireWind

Свой
Регистрация
2 Дек 2005
Сообщения
1,957
Реакции
1,199
Credits
4,009
Delphi – uses controls unit in all versions of Delphi, VCL, FMX
Scott Hollows
[SHOWTOGROUPS=4,20,22]
This shows how to USE the CONTROLS unit in a way that will work for all versions of Delphi (old and new) as well as VCL and FireMonkey.,
You can use variations of this for other units
There are other ways to achieve this, which I wont go into here.
This is how I do it.
Код:
uses
       {$IF CompilerVersion >= 23.0} // 23 is Delphi XE2
            {$IF not declared(FireMonkeyVersion)}
                 VCL.Controls,
            {$ELSE}
                 FMX.Controls,
            {$IFEND}
       {$ELSE} // VCL prior to XE2
            Controls,
       {$IFEND}
       MyOtherUnits;
[/SHOWTOGROUPS]