Create a usercontrol that acts as a container

Posted by CHT on 11-Sep-2014 02:47

Hello,

I want to make a usercontrol thats acts as a "container" for other controls at design time.

I found out how to do this in C# http://support.microsoft.com/?scid=kb%3Ben-us%3B813450&x=21&y=15.

Unfortunately, OE does not support attributes like C#.

Does anybody know a way how to archive this in OE?

Posted by Mike Fechner on 11-Sep-2014 03:51

By implementing ICustomTypeDescriptor you implement the GetAttributes method. So you return all you need to return.

The basis is coming the default TypeDescriptor,that you call into. Then you add your additional attributes.

All Replies

Posted by Mike Fechner on 11-Sep-2014 03:04

One way – not too trivial – is to implement the ICustomTypeDescriptor interface, so that your class adds the required attributes while being executed in the Visual Designer. WE use that all the time to hide properties, add categories and descriptions and also add Designer Verbs.
 
The much simpler solution is to build the UserControl in Cä and import the Assembly into OpenEdge.
 

Posted by CHT on 11-Sep-2014 03:11

I already implementd the ICustomTypeDescriptor interface but i don't know what attributes to set there.

I tried to set the object in the GetAttributes Method but it didn't change anything

Posted by Mike Fechner on 11-Sep-2014 03:18

Well the attributes are described in the C# atricle you shared.

Posted by CHT on 11-Sep-2014 03:44

yeah sorry that was poolry expressed.

I already create the DesignerAttribute Object but i can't seem to add it in the AttributeCollection that is returned because it has only "get methods/properties".

Posted by Mike Fechner on 11-Sep-2014 03:51

By implementing ICustomTypeDescriptor you implement the GetAttributes method. So you return all you need to return.

The basis is coming the default TypeDescriptor,that you call into. Then you add your additional attributes.

Posted by CHT on 11-Sep-2014 03:56

i understand that but i don't know how i add my newly created attribute to the attributecollection that i get from the typedesciptor, because everything is only "get", not "set" in this collection

do i need to create a new collection myself?

Posted by Mike Fechner on 11-Sep-2014 04:00

Yes.

Posted by CHT on 11-Sep-2014 04:27

thank you, it worked

This thread is closed