Form template - creating new form based on existing form

Posted by Admin on 29-Oct-2009 09:52

Maybe this is something I'm not understanding correctly, but I'm having an issue with creating new forms that are inheriting a base class I created that contains a different signature in the constructor.

Basically, I created a base class that has an input parameter in its constructor. When I create the new form, I want to have the new constructor in the form rather than the default. There doesn't seem to be a way to do this without the default constructor being there as well.

When creating the form, the option to uncheck the default constructor is greyed out so I cannot uncheck it. If I select the Generate super class constructors checkbox, I get two constructors, the default without the new parameter and the new one with it. The new constructor does not contain a call to InitializeComponent which means the developer will need to change the code manually each time a form is created.


CONSTRUCTOR PUBLIC NewTestDialog ( ):

    SUPER().
    InitializeComponent().

   
    CATCH e AS Progress.Lang.Error:
        UNDO, THROW e.
    END CATCH.

END CONSTRUCTOR.


CONSTRUCTOR PUBLIC NewTestDialog ( INPUT curParent AS System.Object ):

    SUPER (INPUT curParent).

END CONSTRUCTOR.

Is there any way in OEA to create a template form that can be used to create the new dialogs? I realize I could copy a form and modify the code but I'd really like a way in OEA to do a File / New / MyTemplateForm.

Any help would be appreciated.

Thanks,

Jim

All Replies

Posted by rbf on 29-Oct-2009 10:51

jim.litzie wrote:

Is there any way in OEA to create a template form that can be used to create the new dialogs? I realize I could copy a form and modify the code but I'd really like a way in OEA to do a File / New / MyTemplateForm.

Hi Jim,

Unfortunately this is not possible. We tried it:

http://communities.progress.com/pcom/thread/15947

-peter

Posted by Admin on 29-Oct-2009 12:59

That's not good.

Seems that should be some very standard functionality.

If no one else comes up with a solution, I guess I'll just need to write something that prompts for some basic info and writes out the code for the class.

Not exactly what I was hoping for.

Thanks.

Posted by Matt Baker on 29-Oct-2009 14:07

I'd start by entering an enhancement request for this Standard answer to all of these things .

The customization editor in OEA has all the basic code in it to create a simple wizard that can create a simple file based on your own template.  It won't handle creating anything as complex as a VD form class unless you want to do *ALL* the logic and validation yourself.  There is a whitepaper here on the communities site that explains how to do most of it which can get you started.

If that doesn't work and you are going to write your own plug-in to create your own wizard, then I suggest extending the existing form wizard and just add the code that providese what needs to get added to the template where it generates its own stuff (override doFinish() method), and leave the rest of the wizard as-is since you shouldn't need to change much.  There are already extension points and a customization editor in place in OEA for setting up the template to use based on the template ID.  Unless you want to change how the code gets generated you don't need a separate class template, just create a separate wizard to inject the stuff that ends up in the template.  The existing template already knows how to write out code for constructors.

This thread is closed