Bug in Architect / Visual Designer

Posted by Lieven De Foor on 19-Nov-2010 05:10

Hello,

When a property of a control is changed at design time, this reflects immediately on the screen and you can examine the generated code in the InitializeComponents method. (ex change Text property of Label)

When the property itself is a class, you can drill down the public properties of this property and set these accordingly. Again this is immediately visible on screen and in InitializeComponents.

When you create a user control that has other controls as members and you create properties for these members, you can equally set these at design time when consuming the user control.

The changes are immediately visible on screen, yet the generated code does not contain your settings and when running the code your settings don't show.

When manually adding the code to IntializeComponents that should have been generated this works, but when the code is regenerated (because you've changed another property of the control) you lose your changes.

Have I discovered a bug, or am I doing something wrong here?

All Replies

Posted by Anil Kumar on 19-Nov-2010 06:05

Hi Lieven,

When we drop a UserControl on to a Form, we can change the Properties of the UserControl but not the components within the UserControl. We need to go back to the UserControl if you want to change the properties of individual controls within the User Control and they are then visible in the InitializeComponent of User Control.

We can change the properties of the Inherited Control after dropping the control on the Form but not the controls within User controls.

We should never edit InitializeComponent section in the code, this will always be overwritten whenever we make changes to the Form in design view.

Thanks and Regards,

Anil Kumar.

Posted by Lieven De Foor on 22-Nov-2010 01:19

Hi,

I can't really see the difference between changing properties of 'subcontrols' and those of 'subobjects' of say UltraTextEditor.

eg. UltraTextEditor has a public property Font, who itself contains public properties for size, bold, italic etc. I can set these from the designer, and they show on screen at design time, and change in InitializeComponents so at runtime everything looks ok.

When I have a usercontrol that has a UltraTextEditor as 'subcontrol', and I expose this subcontrol with a public property, then I can see all the subcontrols public properties in the visual designer as expected, I can change them and the screen adapts as expected, yet the code isn't generated to show the changes at runtime too. Adding the needed code to InitializeMyOwnComponent for example works, but should not be needed

It can't be necessary to go back to the usercontrol to change properties, since that can in fact be a component without source.

Posted by jquerijero on 22-Nov-2010 17:22

That is a problem with OE Architect. It is not serializing the code for control exposed as a property. This is probably an unsupported feature that should have been restricted. The control shouldn't have been visible at design-time's Properties grid. This is probably the case since OE Architect Designer still doesn't support classes as properties.

Posted by Lieven De Foor on 23-Nov-2010 01:07

Hi Joseph,

It still seems strange to me that it works for classes as properties for non ABL components (eg. Font property of TextBox is a class and you can access and set all its public 'subproperties').

I'm really tempted to file this as a bug...

Posted by Admin on 23-Nov-2010 04:50

I'm really tempted to file this as a bug...

Go on

But I guess it will be seen as missing functionality.

With .NET classes this behavior does not come for free either. The developer of a property or the class that property refers to has to define designer attributes (like Property Designers etc). The ABL does not support setting those designer attributes at all. In C# it's solved using annotations.

We've solved some basic tasks of customizing the design time behavior of ABL classes by implementing the ICustomTypeDescriptor interface. Google has tons of samples

Posted by jquerijero on 06-Dec-2010 17:34

It is only possible with native .NET class like the IG/Microsoft controls.

Posted by bab on 15-Dec-2010 01:20

For generating code for a public property; property itself a another control, need to specify the following attribute to that property. System.ComponentModel.DesignerSerializationVisiblityAttribute.Content(http://msdn.microsoft.com/en-us/library/system.componentmodel.designerserializationvisibilityattribute.aspx)

The code(C#) look like as follows

[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]

public UltraButton NameButton

{

  get

  {

      return ultraButton1;

  }
}

However Currently Attributes does not supported in ABL. We have plans to support Attributes in the form of Annotations in future.

Posted by Lieven De Foor on 15-Dec-2010 01:42

OK thanks, I'm looking forward to it.

Posted by Admin on 15-Dec-2010 02:32

However Currently Attributes does not supported in ABL. We have plans to support Attributes in the form of Annotations in future.

The obvious question is for which release you are planning this. OpenEdge 11 is still 9 month away and when it's not gonna be in that release we are probably talking about at least 1.5 years before we get this feature.

Looks like we need to live with the ICustomTypeDescriptor solution for quite a while.

This thread is closed