ABL Inherited Control - ContextMenuStrip - Forum - OpenEdge General - Progress Community

ABL Inherited Control - ContextMenuStrip

 Forum

ABL Inherited Control - ContextMenuStrip

  • Hi All

    I'm would like to inherit ContextMenuStrip which is a MS Control.

    This is what i do.

    1. Create a new interited control from the menu - File\Abl Inherited Control. I fill up the name of the new control and i choose the control which i would like to inherit.

    2. I add the new control into OpenEdge Controls.

    3. Then the control is placed onto the form. As soon as i do this i'm getting error message:

    Multiple markers at this line

    - ** C:\PO Workspace\DataSetLab\hist.cls Could not understand line 504. (196)

    - Mismatched number of parameters supplied to 'abc123'. Expecting 0 but 1 were

    specified. (2680)

    on the line which was just generated. THIS-OBJECT:abc1231 = NEW abc123(THIS-OBJECT:components).

    Any help?

    Thanks

    Peter

  • I use OE 10.2b

  • Do you have a constructor that takes an components (System.ComponentModel.IContainer) argument?

    -- peter

  • on the line which was just generated. THIS-OBJECT:abc1231 = NEW abc123(THIS-OBJECT:components).

     

    The Visual Designer detects (using Reflection) that the base type has a constructor that takes an IContainer as a parameter. Just add:

    CONSTRUCTOR PUBLIC abc123 (INPUT container AS System.ComponentModel.IContainer):

    SUPER (INPUT container).

    END CONSTRUCTOR .

    To your abc123 (strange name, I'd say) class.

  • Do you have a constructor that takes an components (System.ComponentModel.IContainer) argument?

    Probably not.

  • Mike,Peter

    I'm sorry about the class name.

    I did try your solution Mike. I'm getting another error message when i try to place object onto the form.

    DYNAMIC-NEW cannot instantiate class poContextMenuStrip (already renamed ) because the wrong number of parameters were passed to the constructor, or the constuctor was not PUBLIC (14758).

    I did try to inherit treeview with no problem.

    Thanks

    Peter

  • Did you remove the default constructor? Should have both ones.

    One for runtime (IContainer) and one for adding it to the form (default constructor).

  • I did try to inherit treeview with no problem.

    MS TreeView only has the default constructor, not the IContainer one. The ContextMenu is a Component (not a Control), so it's member of the Component container so that it can properly be disposed when the Form closes.

  • No i didn't. When i inherited the control there was only one constructor in the source code.

  • And what's the current status? There should be two constructors.

  • I've just created the new one. I ticked "Generate super class constructors" and the second constructor was created and all error messages disapeared.

    CONSTRUCTOR PUBLICpoContextMenuStrip ( ):

      SUPER( ).

      InitializeComponent().

      CATCH e AS Progress.Lang.Error:

      UNDO, THROW e.

      END CATCH.

    END CONSTRUCTOR.

    CONSTRUCTOR PUBLIC poContextMenuStrip ( INPUT container AS System.ComponentModel.IContainer ):

      SUPER (INPUT container).

    END CONSTRUCTOR.

    Just another question. There is missing code in the second constructor. I know i can just copy it there from the first one but does it have any particular reason why it is not generated?

    Thank you

    Peter

  • Just another question. There is missing code in the second constructor. I know i can just copy it there from the first one but does it have any particular reason why it was not generated?

     

    That should be asked to the developer of OEA. But I'd rather remove the CATCH block from the first constructor as well.

  • Thank you very much for all your effort Mike.

    Have a nice weekend.

    Peter

  • Have a nice weekend.

     

    You must have missed the soccer score...

  • Have a nice weekend.

    You must have missed the soccer score...

    You're talking about 2-2 after being 0-2 down?

    (Have no fear, the "Mannschaft" will be there at the end)

    -- peter