Inheritance

Add-in Express™ Support Service
That's what is more important than anything else

Inheritance
 
Michiel


Guest


Hello,

I am trying to use the main TAddinModule file (with _IMPL in the filename) as a base class so I can have an inherited variant of the addin.
To do this I have changed the file class definition to TAddInModuleBase = class(TadxCOMAddInModule) and used delphi's inheritence method (File-> New -> Other... -> Inheritable Items -> AddinModuleBase.
I named the inherited class the same as the original used to be (AddinModule) and the file also just like the original addin filename. Then I have moved the TadxFactory.Create line in the intialisation to the inherited file.

Initially this seems to go alright. The controls on the adxRibbonTab are showing up in the derived file fine.
Yet as I compile the controls on the ribbontab are gone. And also when I restart delphi the buttons remain gone. I have a blank ribbontab. The base class still has everything.

Code seems to be run ok, when I debug I see the adxCOMAddInModuleAddInInitialize function of the base class is processed. Also code on the derived class seems to run fine.

What could be the reason the visual controls are lost on the derived file? Am I missing a step / do I need to include some other data in the derived file?

Thanks.
Posted 15 Aug, 2022 10:29:02 Top
Andrei Smolin


Add-in Express team


Posts: 18791
Joined: 2006-05-11
Hello Michiel,

It looks like the corresponding DFM file isn't connected for some reason. If you can't solve this, you can try creating Ribbon controls on the fly, say, in the OnRibbonBeforeCreate event of the add-in module.

Regards from Poland (CEST),

Andrei Smolin
Add-in Express Team Leader
Posted 16 Aug, 2022 05:56:52 Top
Michiel


Guest


Hello Andrei,

Indeed the DFM file had some 'empty' ribbontab skeleton code overwriting the base class... I did not check that yet. When I removed this code the controls showed up again. It seems this has resolved the problem. But this skeleton inclusion should not have happened, should it?
Thanks anyway for pointing me in the right direction!

Best regards,
Michiel
Posted 16 Aug, 2022 08:18:05 Top
Andrei Smolin


Add-in Express team


Posts: 18791
Joined: 2006-05-11
Hello Michiel,

We don't know how the visual designer of the Delphi IDE handles inherited classes. To avoid issues in this area you'd better create Ribbon controls at the run time; you can do this in the constructor of the add-in module or in the OnRibbonBeforeCreate event.

Regards from Poland (CEST),

Andrei Smolin
Add-in Express Team Leader
Posted 16 Aug, 2022 10:25:05 Top