Skip to content

OTAFormWizard using form inheritance. #1

Description

@giorgiobazzo

Hello,

Your repository was recommended to me by Embarcadero support itself. I looked for something that could help me in your e-book "The Delphi IDE Open Tools API - Version 1.2", but I didn't find exactly what I was looking for. So I hope you read this Issue and can help me!

Let's go!

For some time I have been trying (but without success) to use OTAFormWizard and register a Wizard to create forms that are based on another base form.

The idea is to have a base form, with all the common visual parts (buttons, panels, etc.) already defined, and for the Wizard to create new forms from this base form.

I managed to get the Wizard to create the unit (.pas) with the desired code, but it does not inherit the visual part (.dfm) as expected, the new form is created empty,
without the components that are in the base form.

I used the IOTAModuleCreator interface to create the .pas implementing the NewImplSource function, and that worked.
But even implementing NewFormFile with the desired .dfm code, when I create the new form through File|New|Other|New I receive this message:

image

It seems that the Wizard doesn't understand that I want to create a form that inherits the components of its ancestor. Then he adds the unit to the project (.dpr) using:

...
contains
....
   Unit1 in 'Unit1.pas' {fmBaseForm1: TfmBaseForm};

rather than:

...
contains
....
   Unit1 in 'Unit1.pas' {fmBaseForm1};

that would be correct.

And also in the .dproj file something like:

         <DCCReference Include="Unit1.pas">
             <Form>fmBaseForm1</Form>
             <FormType>dfm</FormType>
             <DesignClass>TfmBaseForm</DesignClass>
         </DCCReference>

where the DesignClass element should not be added for it to work as expected.

I know I can get a similar result using the "Add to Repository" option, but I think that with wizard it would be better to standardize several IDE installations.

I'll attach an example of the approach I'm trying to use.
InheritedFormWizard.zip

Finally, I would like to know if this is possible, and what might be missing in my example to make it work.

Grateful! Any help will be welcome!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions