Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there simpler way of saying that Delphi component/control is supported on all platforms?

Tags:

delphi

In order to make Delphi component/control available for all (currently) available platforms I have to write

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

before component/control declaration:

type
  [ComponentPlatforms(pidWin32 or ...)]
  TMyComponent = class(TComponent)
  end;

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

like image 291
Dalija Prasnikar Avatar asked Dec 15 '14 15:12

Dalija Prasnikar


1 Answers

There is no simpler way, but you could define those as one constant:

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

and use that each time you create a new component. But, assuming you don't produce that many components, what is wrong with writing it out in full, the few times it is needed?

I also assume that if you simply omit the attribute, the component will be considered as supporting all platforms. You could test that.


There is actually a similar constant AllPlatforms in ToolsAPI/PlatformAPI but that unit is not for general runtime use.

like image 68
Rudy Velthuis Avatar answered Sep 18 '22 22:09

Rudy Velthuis