Jump to content
dmitrybv

How to set Supported platforms for my component?

Recommended Posts

Hello
How to set which platforms my component supports?
I found the System.Classes.ComponentPlatformsAttribute attribute, but it seems that there are other ways.
For example, the TDataSource component does not have the ComponentPlatformsAttribute attribute set, but the Hint component palette shows that TDataSource supports all available platforms.

sshot-360.png

Share this post


Link to post

You need to add an attribute to your class:


  [ComponentPlatformsAttribute(pidAllPlatforms)]
  TZxButton = class(TZxCustomButton)
  
  end;

You also need to add System.Classes to your uses unit.

Share this post


Link to post

There is information that when adding a new platform to the list of target platforms of the package, all components of the package are considered fully functional on these platforms.

 

 

post-1-0-27801200-1400769745.png

post-1-0-96651000-1400769744_thumb.png

Share this post


Link to post
14 minutes ago, dmitrybv said:

There is information that when adding a new platform to the list of target platforms of the package, all components of the package are considered fully functional on these platforms.

 

 

post-1-0-27801200-1400769745.png

post-1-0-96651000-1400769744_thumb.png

Correct. If you register your component that has the attribute I mentioned, it will display all the platforms in that hint you screenshotted.

Share this post


Link to post
Posted (edited)
2 hours ago, dmitrybv said:

How to set which platforms my component supports?
I found the System.Classes.ComponentPlatformsAttribute attribute

By annotating it with the ComponentPlatforms attribute:

https://docwiki.embarcadero.com/Libraries/en/System.Classes.ComponentPlatformsAttribute

2 hours ago, dmitrybv said:

but it seems that there are other ways.

Not that I'm aware of.  Which ways are you thinking of?

2 hours ago, dmitrybv said:

For example, the TDataSource component does not have the ComponentPlatformsAttribute attribute set, but the Hint component palette shows that TDataSource supports all available platforms.

When a component does not indicate any specific platforms, then it is available for all platforms, limited only by the framework it uses.  A VCL component without ComponentPlatforms will support all platforms that VCL supports, namely Windows 32bit and 64bit.  An FMX component without ComponentPlatforms will support all platforms that FMX supports.

 

TDataSource derives directly from TComponent and has no affinity to either VCL or FMX, so it will support whichever framework your project is using, and thus whichever platforms that framework supports.

Edited by Remy Lebeau
  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×