VCL Firemonkey Component name conflict [Edit]

I am writing VCL and Firemonkey versions of a component and want to use the same component name on both frameworks. XE6 Update 1

I install one framework package but when I install the second package I get an error that TMyComponent is already registered with the first package however when I restart the IDE both the VCL and Fm packages are checked as installed in the list of packages.

I create either a new VCL Forms application or a new Fm Desktop application and the correct version of TMyComponent can be added to it from the Tool Pallette. 
I then "Close all" and create a new application using the other framework and again the correct framework TMyComponent is shown on the Tool Pallette however when I add it to the project I get an EFiler error that it cannot be registered because it is already registered in the first package. If I restart the IDE I can then use the component in the second framework sucessfully.

It seems that I am missing some instruction or setting which would unload the package from memory when I change framework. Any ideas as to what it is? 


The dproj files for the packages are set to the framework:
        <FrameworkType>VCL</FrameworkType>
and  
        <FrameworkType>FMX</FrameworkType>
respectively.

My Register procedures look like this

{code}
procedure Register;
begin
//  StartClassGroup(Vcl.Controls.TControl);
//  ActivateClassGroup(Vcl.Controls.TControl);
  GroupDescendentsWith(TMyComponent, Vcl.Controls.TControl);
  RegisterComponents('MyComponents VCL', [TMyComponent]);
end;

initialization
//  StartClassGroup(Vcl.Controls.TControl);
//  ActivateClassGroup(Vcl.Controls.TControl);
  GroupDescendentsWith(TMyComponent, Vcl.Controls.TControl);
{code}

and in the Fm package

{code}
procedure Register;
begin
//  StartClassGroup(FMX.Controls.TControl);
//  ActivateClassGroup(FMX.Controls.TControl);
  GroupDescendentsWith(TMyComponent, FMX.Controls.TControl); //TFmxObject);
  RegisterComponents('MyComponents FMX', [TMyComponent]);
end;

initialization
//  StartClassGroup(FMX.Controls.TControl);
//  ActivateClassGroup(FMX.Controls.TControl);
  GroupDescendentsWith(TMyComponent, FMX.Controls.TControl);
{code}

As you can see I have tried most permutations however these seem to work the best.
0
Leslie
6/25/2014 2:26:46 PM
embarcadero.delphi.firemonkey 4901 articles. 4 followers. Follow

5 Replies
1388 Views

Similar Articles

[PageSpeed] 53
Get it on Google Play
Get it on Apple App Store

Leslie wrote:

> I install one framework package but when I install the second package
> I get an error that TMyComponent is already registered with the first
> package however when I restart the IDE both the VCL and Fm packages
> are checked as installed in the list of packages.

The standard components use Unit Scope names, where commonly named components 
(like TEdit, TLabel, etc) are in different namespaces.  You might need to 
do the same thing in your code.

> My Register procedures look like this

Don't do the grouping in the initialization section, only inside of Register().

--
Remy Lebeau (TeamB)
0
Remy
6/25/2014 6:16:26 PM
> {quote:title=Remy Lebeau (TeamB) wrote:}{quote}
> Leslie wrote:
> 
> > I install one framework package but when I install the second package
> > I get an error that TMyComponent is already registered with the first
> > package however when I restart the IDE both the VCL and Fm packages
> > are checked as installed in the list of packages.
> 
> The standard components use Unit Scope names, where commonly named components 
> (like TEdit, TLabel, etc) are in different namespaces.  You might need to 
> do the same thing in your code.
> 
> > My Register procedures look like this
> 
> Don't do the grouping in the initialization section, only inside of Register().
> 
> --
> Remy Lebeau (TeamB)

Thank you for this Remy

I have done this so that my Register procedures now look like:
{code}
procedure Register;
begin
  GroupDescendentsWith(Vcl.MyComponents.TMyComponent, Vcl.Controls.TControl);
  RegisterComponents('MyComponents VCL', [Vcl.MyComponents.TMyComponent]);
end;
{code}
and
{code}
procedure Register;
begin
  GroupDescendentsWith(FMX.MyComponents.TMyComponent, FMX.Controls.TControl);
  RegisterComponents('MyComponents FMX', [FMX.MyComponents.TMyComponent]);
end;
{code}

with nothing in initialization section

However it is behaving exactly the same as before.
When I restart the IDE I can create a new application in either framework and add a TMyComponent to it from the Tool Pallete
If I create a new application in the other framework the TMyComponent changes as expected in the Tool Pallete however I get an EFiler error if I try to add it to the application form.

If I restart the IDE then I can then create a new application in the other framework and add a TMyComponent to it as expected however I cannot then change to the first framework and add a TMyComponent to that without getting the EFiler error.
0
Leslie
6/25/2014 8:11:25 PM
Leslie wrote:

> However it is behaving exactly the same as before.

Then you simply won't be able to have both sets of packages loaded at the 
same time.  Which is not a bad thing.  It is not a good idea to have unnecessary 
packages loaded all the time.  You should configure the IDE to NOT load all 
packages by default, and then you can enable specific packages on a per-project 
basis as needed.  This reduces unnecessary clutter in the DPK/DPROJ files, 
and reduces IDE overhead and conflicts.

Otherwise, why not just have 1 version of the component that compiles for 
both VCL and FMX?  Do you really need to maintain 2 separate versions?

--
Remy Lebeau (TeamB)
0
Remy
6/25/2014 8:30:49 PM
> {quote:title=Remy Lebeau (TeamB) wrote:}{quote}
> Leslie wrote:
> 
> > However it is behaving exactly the same as before.
> 
> Then you simply won't be able to have both sets of packages loaded at the 
> same time.  Which is not a bad thing.  It is not a good idea to have unnecessary 
> packages loaded all the time.  You should configure the IDE to NOT load all 
> packages by default, and then you can enable specific packages on a per-project 
> basis as needed.  This reduces unnecessary clutter in the DPK/DPROJ files, 
> and reduces IDE overhead and conflicts.
> 
> Otherwise, why not just have 1 version of the component that compiles for 
> both VCL and FMX?  Do you really need to maintain 2 separate versions?
> 
> --
> Remy Lebeau (TeamB)

My component heavily uses each frameworks (Printer, Canvas, Bitmaps as well as dialogs and forms) so I need to have a version for each.
For myself I could do these workarounds however I hope to release it commercially so it has to be perfect.
It must be possible to achieve the same component name on each framework as it is done for FastReports and TChart as well as for many of the built in controls.

Thank you for your time looking at this.
0
Leslie
6/26/2014 7:03:09 AM
> {quote:title=Leslie Kaye wrote:}{quote}
> I am writing VCL and Firemonkey versions of a component and want to use the same component name on both frameworks. XE6 Update 1
> 
> I install one framework package but when I install the second package I get an error that TMyComponent is already registered with the first package however when I restart the IDE both the VCL and Fm packages are checked as installed in the list of packages.
> 
> I create either a new VCL Forms application or a new Fm Desktop application and the correct version of TMyComponent can be added to it from the Tool Pallette. 
> I then "Close all" and create a new application using the other framework and again the correct framework TMyComponent is shown on the Tool Pallette however when I add it to the project I get an EFiler error that it cannot be registered because it is already registered in the first package. If I restart the IDE I can then use the component in the second framework sucessfully.
> 
> It seems that I am missing some instruction or setting which would unload the package from memory when I change framework. Any ideas as to what it is? 
> 
> 
> The dproj files for the packages are set to the framework:
>         <FrameworkType>VCL</FrameworkType>
> and  
>         <FrameworkType>FMX</FrameworkType>
> respectively.
> 
> My Register procedures look like this
> 
> {code}
> procedure Register;
> begin
> //  StartClassGroup(Vcl.Controls.TControl);
> //  ActivateClassGroup(Vcl.Controls.TControl);
>   GroupDescendentsWith(TMyComponent, Vcl.Controls.TControl);
>   RegisterComponents('MyComponents VCL', [TMyComponent]);
> end;
> 
> initialization
> //  StartClassGroup(Vcl.Controls.TControl);
> //  ActivateClassGroup(Vcl.Controls.TControl);
>   GroupDescendentsWith(TMyComponent, Vcl.Controls.TControl);
> {code}
> 
> and in the Fm package
> 
> {code}
> procedure Register;
> begin
> //  StartClassGroup(FMX.Controls.TControl);
> //  ActivateClassGroup(FMX.Controls.TControl);
>   GroupDescendentsWith(TMyComponent, FMX.Controls.TControl); //TFmxObject);
>   RegisterComponents('MyComponents FMX', [TMyComponent]);
> end;
> 
> initialization
> //  StartClassGroup(FMX.Controls.TControl);
> //  ActivateClassGroup(FMX.Controls.TControl);
>   GroupDescendentsWith(TMyComponent, FMX.Controls.TControl);
> {code}
> 
> As you can see I have tried most permutations however these seem to work the best.

The resolution was received from Roy Nelson of Embarcadero after my filling a support request. Thanks Roy.

The working code is 
{code}

uses System.Classes, FMX.Controls, FMX.Types, FMX.MyUnit;

procedure Register;

implementation

procedure Register;
begin
  GroupDescendentsWith(FMX.MyUnit.TMyComponent, FMX.Types.TFmxObject);
  GroupDescendentsWith(TMyAncestorComponent, FMX.Types.TFmxObject);
  RegisterFmxClasses([FMX.MyUnit.TMyComponent, TMyAncestorComponent]);
  RegisterComponents('MyComponents', [FMX.MyUnit.TMyComponent]);
end;
{code}
and for Vcl
{code}
uses System.Classes, Vcl.Controls, Vcl.MyUnit;

procedure Register;

implementation

procedure Register;
begin
  GroupDescendentsWith(TMyComponent, Vcl.Controls.TControl);
  GroupDescendentsWith(TMyAncestorComponent, Vcl.Controls.TControl);
  RegisterClasses([TMyComponent, TMyAncestorComponent]);
  RegisterComponents('MyComponents', [TMyComponent]);
end;
{code}

The class heirachy is 
TComponent - TMyAncestorComponent - TMyComponent

so that originally not only was TMyComponent conflicting in the Filer but also was TMyAncestorComponent
0
Leslie
6/30/2014 4:57:08 PM
Reply:

Similar Artilces:

Delphi / FireMonkey release components created at runtime [Edit]
Hello, XE6, Win7 Am I right I thinking that if I create a component, such as TImage, at runtime, Delphi automatically releases the memory when the program closes. I declared this: im: TImage; as a TForm variable. Put this in .FormCreate: ReportMemoryLeaksOnShutdown := DebugHook <> 0; This picks up things like TStrokeBrush when I don't run .Free; I then put this in: procedure TFrmScales.Button4Click(Sender: TObject); begin im := TImage.Create(self); im.Bitmap.Assign(I_note.Bitmap); // I_note is a TImage that I put there at design-time im.Pa...

Firemonkey components [Edit]
I am rather new to firemonkey and was wondering where to find information on the purposes of certain controls. I am using XE8 update 1, mostly with Android 4.x. Some of the controls look much like other controls so I don't know when to use a particular control v/s when to use another. Is there an article describing the controls and the nuances or advantages of one control of another similar control. I need to know the purpose of a tlayout control, what does it give you when below the form compared to a tpanel. What is the purpose of a toolbar. How does a tstatus work. It seems to...

Installing components for FireMonkey HD and FireMonkey iOS
Hi, How do I install components for both FireMonkey HD and FireMonkey iOS? I have one package 'FMXMyFireMonkeyControl' and 'FMIFireMonkeyControl' which both point to the same file with the same registration 'TFireMonkeyControl'. If I compile one package (FMXMyFireMonkeyControl) it installs correctly, then change the include file (FMCompile.INC) to compile for IOS (FMIFireMonkeyControl) which is included in the FMX.FireMonkeyControl.pas file: {$I FMCOMPILE.INC} uses {$IFDEF COMPILEIOS} FMX_Types, FMX_Objects, FMX_Forms, FMX_Dialogs, FMX_Effe...

LookupCombobox component under Firemonkey [Edit]
Hello, How can I manage this ? : I have a dataset with ID and Description fields. I need the records to be displayed in a comboBox. Description need to be displayed (in the listbox and with the selected element). ID should be associated with the available items. I'm able to display these records on a comboBox (using livebindings) but I can't find a way to get the ID value. Here is how I've set my visual binding : [BINDSOURCEDB].ID ----> [COMBOBOX].Item.LookupData [BINDSOURCEDB].Description ----> [COMBOBOX].Item.Text Here is my code (OnButonClick) i...

Build Component in Firemonkey [Edit]
Hi, How to build a component in firemonkey to display some numbers that is retrieved from a database table field. Can I get some idea or any examples available? Edited by: Rolance Kripakaran on May 14, 2012 2:52 AM > {quote:title=Rolance Kripakaran wrote:}{quote} > Hi, > > How to build a component in firemonkey to display some numbers that is retrieved from a database table field. > > Can I get some idea or any examples available? > There's three tasks you'll need to master to get that done. Firstly you'll need to know about LiveBindings...

Firemonkey component funnies [Edit]
Hi All, I've been using Delphi from V3 to V8, and now see it will produce iPad apps. I've downloaded a trial of EX2 and have an odd issue: I'm a bit rusty, so may bear with me! Platform set to win32 (to debug), TIdHTTP dropped on the form. Code completion offers .get for IdHTTP1, but I get 'IdHTTP1 does not contain a member get' IdHTTP1.Get('http://www.bbc.co.uk'); What am I missing? Ta. Edited by: martin moore on Sep 29, 2011 8:33 AM > {quote:title=martin moore wrote:}{quote} > Hi All, I've been using Delphi from V3 to V8, and no...

Firemonkey components on VCL Form
Hello Everyone, I am new to Firemonkey Framework and I have been playing with it for a few days, and I have a question. Is it possible to use Firemonkey components in VCL forms or vice versa ? Thank you. Shahriar wrote: > Is it possible to use Firemonkey components in VCL forms or vice versa? Mixing VCL and FireMonkey together in the same app is not officially supported, but it is technically doable with a little effort. There have been several blogs posted online that explain how to do it, search around. -- Remy Lebeau (TeamB) ...

Firemonkey custom component [Edit]
I'm using Delphi XE8 and trying to create a cross-platform component for FireMonkey. But I'm facing some problems. Although up the properties "Width" and "Height" in the Object Inspector to compile apparently the size settings are ignored. And when I reopen the project my component is also small. (I noticed that the width and height settings are not saved to the DFM file). Note: All other native components of FireMonkey work properly, just my custom not. Whats the problem? {code} TCard = class(TControl) private { Private declarations } FC...

Firemonkey-Mobile: GridView component? [Edit]
Hello everybody, i'm trying to develop some sample mobile apps with FireMonkey framework. I see that in Tool Palette there is a TListView component, but not a TGridView component. I'm very surprised of this lack, due GridView should share the same logic of ListView, only the layout should be different ( Android work in that way - http://developer.android.com/guide/topics/ui/declaring-layout.html#AdapterViews ). There are other grid components (TGridLayout, TGridPanelLayout) but them haven't the same behavior and features of ListView. So, No way to implement a GridView? Thank yo...

New converter VCL to FireMonkey !!!! [Edit]
I have found a new program (MIDA) for convert automatically DFM and Pas in FMX and pas. it's GREAT !!! don't convert all, of course, but it is very useful. I converted a project VCL , 20 forms, and I have spent using a morning instead of a week:) i was any TMS Pack component in my project and it work in FM :) The next version will support more pascal update ( application.MessageBox / application.exename ... ). two picture from site : Win 32 VCL : http://img836.imageshack.us/img836/9877/vcl.png FireMonkey : http://img198.imageshack.us/img198/1294/firemonkey...

ANN: New Firemonkey Components [Edit]
Check out what is cooking for the Beta 6 release of Apesuite... http://arcana.sivv.com/blog/2012/5/3/apesuite-beta-6-preview-and-sivv-support-site.html -- Arcana components for Delphi, Intraweb and Firemonkey http://arcana.sivv.com Edited by: Jason Southwell on May 3, 2012 3:55 PM From your website: "Your purchase includes source code and updates for a period of one year." The one year period start with the release of version 1 or it include the beta testing time? > {quote:title=Jason Southwell wrote:}{quote} > Check out what is cooking for the Beta 6 rel...

Ann: FastReport FMX for Delphi XE3 (FireMonkey 2) and XE2 (FireMonkey) released
Dear friends, Visual report designer is available now on both MS Windows and MAC OS X! Full sources. We can write here full list of possibilities, but it will so long. Let see FastReport VCL and FastReport FMX comparison table: http://www.fast-report.com/en/products/comparison-fast-report-firemonkey-vcl.html And all of this - just now in your hands for business-applications for Mac. Report generator FastReport FMX is the first multiplatform solution for including Business Intelligence into software based on Embarcadero FireMonkey IDE (Delphi for MS Windows and Apple Mac OS X)...

MIDA - Vcl To FireMonkey converter
I am here to present the immediate availability of the best converter from VCL to Firemonkey. More than 200 components converted to the nearest component firemonkey. I remember that the two technologies are very different, can not ‘exist a true total conversion. but you can get a new project with a few change can be compiled in Firemonkey. With the next versions will update the database conversion ( online ), for example when it is available for a real TRichEdit under FM, MIDA will convert automatically the old TRichEdit. The time to create MIDA was rather long and complex. ...

MIDA - Vcl To FireMonkey converter
This message is no longer available. > {quote:title=Mida FireMonkey wrote:}{quote} > I am here to present the immediate availability of the best converter from VCL to Firemonkey. > > > More than 200 components converted to the nearest component firemonkey. > > I remember that the two technologies are very different, can not ‘exist a true total conversion. but you can get a new project with a few change can be compiled in Firemonkey. > > With the next versions will update the database conversion ( online ), for example when it is available for a real TRi...

Web resources about - VCL Firemonkey Component name conflict [Edit] - embarcadero.delphi.firemonkey

Firemonkeys - GamesIndustry International
The world's leading games industry website. Get insight from todays industry leaders with news, interviews and analysis of global gaming trends. ...

Firemonkey’s Real Racing 3 To Launch At The End Of February
In September, Apple demoed Firemonkey’s Real Racing 3 at the iPhone 5 event . Three months later and the game has yet to show up in the App Store. ...

EA Games and Firemonkey Bringing Real Racing 3 to Android, Fasten your Seat Belts
Start up your engines race fans, EA Games is teaming up with Firemonkey to bring Real Racing 3 to mobile devices. If you’re a fan of more realistic ...

EA's Firemint and IronMonkey Studios Merge to Become FireMonkeys
... game development studios into one mega-studio in Australia. Firemint and IronMonkeys will be merged into a single studio now known as Firemonkeys ...

News: Firemonkeys announces Real Racing 3
Firemonkeys, a new gaming subsidiary of Electronic Arts born from the merger of FireMint and IronMonkey, has announced the coming release of ...

firemonkeys - iMore
EA has pushed out another impressive update to its equally impressive iOS racer, Real Racing 3, that for the first time brings cars from Ferrari ...

Firemonkeys on Real Racing 3 going free-to-play
... got a hands-on preview of Real Racing 3. We also spoke with Ptolemy Oberin, one of the game’s programmers and project lead at developer Firemonkeys, ...

Real Racing 3 coming in 2012 from Firemonkeys
The first game from recently merged developer Firemonkeys is Real Racing 3 , the developer revealed moments ago during EA's Summer Showcase event ...

Firemonkeys Previews Real Racing 3 for iPhone and iPad
Firemonkeys, the new combined studio from EA combining the IronMonkey and Firemint gaming studios, has announced the development of Real Racing ...

EA Mobile Moves: IronMonkey & Firemint Merge Into “Firemonkeys,” Now Have 50M Players Between
... that it is merging two top mobile game studios, IronMonkey and Firemint , which will fittingly combine to create a new company, called Firemonkeys. ...

Resources last updated: 12/14/2015 4:10:01 AM