Canvas subclass has integer property “property1” that is initialized thusly in the class’s Constructor:
// Calling the overridden superclass constructor.
Super.Constructor
property1=234
But when you inspect a canvas instance during runtime, property1 is 0.
If you put the code into the Open event of the abstract class, it works as expected. I imagine this is because the order of events is Constructor and then Window initialization, which makes sense but is nonsensical.
Before opening the door of a house, it must be constructed. Why is it non sensical ?
It has been burried in the forum so I could not find it back, but I remember reading a while ago that properties values set in constructor get lost when the control opens.
This sounds slightly paradoxical to me:[quote=175977:@Eric Williams]which makes sense but is nonsensical.[/quote]
AFAIK this is order:
For all controls
Control Constructor
Control IDE property settings are applied
Control Open event
Next
Window Constructor
Window IDE property settings are applied
Window Open event
When the Open event is raised, the control or window is set-up properly including the IDE property settings applied , but not yet visible.
The IDE effectively writes code that calls “Constructor” on your control class to get a new instance.
At that point all properties exist and are default values for their type.
Then all the properties are set - one at a time.
So If you write a control & try to rely on a property value in that controls constructor it can be “incorrect”.
We’d have to alter the control and magically add a constructor that took all the property values as arguments and set them and make the very last line a call your constructor with no arguments. And god forbid you had a constructor for a control that took some arguments but no zero argument form.
BUG is debatable.
Known behavior - most definitely.