6

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

cadetill
  • 1,552
  • 16
  • 24
  • What kind of components do you have? Visual or Nonvisual? – Sir Rufo Jan 02 '13 at 19:51
  • @Sir Rufo they are a non visual components – cadetill Jan 02 '13 at 20:01
  • non visual components are not related to VCL or FMX. why would you seperate? Do you think TADOConnection is different in VCL and FMX? – Sir Rufo Jan 02 '13 at 20:05
  • @Sir Rufo this components have some properties (like Color) that are dependent of framework (in VCL is TColor and in FMX is TAlphaColor) and/or need some libraries that are dependence of framework (like Dialogs) – cadetill Jan 02 '13 at 20:14
  • @Cadetill If your component is referencing Colors and Dialogs, then your component is not truly non-visual. Consider refactoring out those references or seperating it into a run-time and a design-time package. – Alan Clark Jan 03 '13 at 18:49
  • @Alan Clark The components that I'm doing are to manage the Google Maps API. In them I specify the features of the map, markers, polylines,.... That is why I can't separated into different packages their properties. – cadetill Jan 03 '13 at 21:28

2 Answers2

6

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

cadetill
  • 1,552
  • 16
  • 24
0

You can use in the Register procedure code from this answer : Delphi XE2: Is there a predefined conditional to identify VCL and FireMonkey? to check whether it is Firemonkey or VCL application.

Community
  • 1
  • 1
Nickolay Olshevsky
  • 13,706
  • 1
  • 34
  • 48