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

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.

The technique listed here is useful when developing Delphi controls or units that you will provide to other people. It works without requiring any changes to their project or IDE options.

       {$IF CompilerVersion >= 23.0} // 23 is Delphi XE2
            {$IF not declared(FireMonkeyVersion)}
       {$ELSE} // VCL prior to XE2

+1 this post

If you like this post, please up-vote it on BeginEnd – Thank You

About The Author

The Usual Suspect
– Scott Hollows –

  • Oracle and Delphi software developer.
  • Australian Delphi User Group
    – Western Australia Branch Manager
    – National committee member
    – Past president

Published by

One response to “Delphi – uses controls unit in all versions of Delphi, VCL, FMX”

  1. You could simply add “Controls” without the prefix and let the IDE/compiler figure it out using the Unit Scope Names configuration option of the project.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: