Is there an easier way to say a Delphi component / control is supported across all platforms?

To make a Delphi component / item available to all (currently) available platforms, I have to write

  [ComponentPlatformsAttribute(pidWin32 or pidWin64 or pidOSX32 or pidiOSSimulator or pidiOSDevice or pidAndroid)]

      

before the component / control declaration.

Is there a shorter way of writing this component that supports all current and future platforms ?

+3


source to share


2 answers


There is no easier way, but you can define them as one constant:

const
  AllCurrentPlatforms = 
    pidWin32 or pidWin64 or pidOSX32 or 
    pidiOSSimulator or pidiOSDevice or pidAndroid;

      

and use this every time you create a new component. But, assuming you are not creating many components, what is wrong with writing this in its entirety, is it necessary a few times?



I also assume that if you just omit the attribute, the component will be considered cross platform support. You can check it out.


There is actually a similar constant AllPlatforms

in ToolsAPI / PlatformAPI, but this device is not shared at runtime.

+4


source


A simple, completely hacky way to create components / controls for all platforms:

  [ComponentPlatformsAttribute(0)]

      



or in another way

  [ComponentPlatformsAttribute($FFFF)]

      

0


source







All Articles