How to make a component that support both FMX and VCL


The question have already been asked, but I still can’t find a good way to do it. I just made a component who simply draw some stuff on a TForm. basically it’s exactly the same code regarding FMX or VCL, but on fmx it’s use FMX.form and on vcl it’s use VCL.form.

How to make my component compatible with both framework? Ideally I don’t want to split the unit (one FMX.myunit.pas and one VCL.myUnit.pas for exemple)
How to make my component appear in the tools palette only for VCL project or only for FMX project or for both projects ?
How in my dpr/dproj can I say that my project use VCL or FMX framework? Can a project use both Framework, VCL and FMX?
For fmx components, why I need to do RegisterComponents(‘myGroup’, [TMyControl]); followed by RegisterFmxClasses([TMyControl]); (It’s look like this in all sample I saw).

Comments are closed.