For a custom canvas, I have added an integer property “HeadSection” that I keep as a constant while designing the paint event - which means I have initially assigned a value of 40 to it but found it later to be a bit too small, so I changed it even a whole bit more:
When I ran this, I noticed no differences. Pushing the value to console (in the paint event):
I see it still has a value of 40. Even quitting Xojo and reloading the project didnt change anything.
I could fix it by assigning the new value in the open event to headsection, but thats not what I was intending with the constant.
Can anyone confirm this? Values keeping their start value despite a later change in the iDE? I swear a full text search in the IDE brought no other lines where I incidentally reset it to 40.
I was suspecting that too, but no, no inspector behavior. And I didnt create one before (I know sometimes it’s a bit difficult to get rid of old inspector definitions).
P.S.: And I know sometimes I do make silly mistakes, but I cannot find anything in here. I can forward you the project, its just the canvas subclass drawing to a window.
Another EDIT: But, if I open the inspector behavior panel as if I would want to add a property, the IDE proposes a default value of 40. Inspector behavior looks like a good path to pick up - it seems to set the value to the one initially defined even if there is no behavior added.
Just tested and I can confirm.
If you have an instance it remain with the original value.
If you change the default value and create a new instance it will have the original value
If you change the default value in the behavior page even if it’s not exposed then the new instance will have the new value.
The trouble source is that the behavior leads and it’s default value doesn’t change if you change the property default value.
It’s like having 2 default value one that you can edit directly but works only the first time, the second one in the property behavior that once created leads but this “behavior” is hidden to the user.
A solution could be that when I edit the default value in one place, the same (at least for primitive values) is exposed on the other place.
You are right.
If you export the class as text you can see clearly the problem. (two different default value and the behavior one leads, for me this is correct and changing it could break a lot of code)
So update both the value when you edit one is the correct solution (without any impact)
Every instance gets a copy of the values exactly as they exist when you drag the instance in to a layout
Subsequent changes to default values on the base class are NOT replicated
IF you change the base class & the IDE pushed that change out every instance on a layout it would wipe out numerous altered values
ie/ suppose instead of the default value for header hight this was “width”
You drag an instance onto a layout and set its width to “60” but the original default was 30
Now you change the base class to have a default of 40
If we changed every instance to 40 you’d be equally upset for the opposite reason - “The IDE wiped out my changes”
But this is a different matter.
you edit the default value, then add the control to the window and you have the old value.
What I’m talking about is not to change the instance behavior (hidden or not), but the base class default values, where you set one in the IDE and the behavior value will be used. This force you (if you know this “feature”) to edit twice the value.
If you see the class files attached to the feedback, the different values are in the base class, not in the instance!