Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a new component compatible with VCL and FMX

Tags:

delphi

I'm doing some components and I want to do them compatibles for VCL and FMX. So I have a structure that follows this pattern:

General_dpk (with TCustomMyClass) + VCL_dpk (with TMyClass) + FMX_dpk (with TMyClassFMX)

Each package have their register procedure that registered their components. In the components palette appears both components (VCL and FMX). How to do that only appears the components according the type of project selected (VCL or FMX) like the others Delphi components?

Thanks

like image 863
cadetill Avatar asked Jan 02 '13 12:01

cadetill


1 Answers

Well, after a long search I have asked in the Embarcadero forum. There, Remy said me the answer kindly (easy when you know it). The thing is that you need to call GroupDescendentsWith function into the register procedure like this

// para componentes VCL
GroupDescendentsWith(TMyClass, Vcl.Controls.TControl);

// para componentes FMX
GroupDescendentsWith(TMyClassFMX, Fmx.Types.TControl);

The answer on Embarcadero forum here

like image 183
cadetill Avatar answered Nov 02 '22 15:11

cadetill