IDE keeps old value for property

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):

g.ClearRect 0,0,me.Width, me.Height g.ForeColor = color.lightgray g.DrawLine 0,me.headsection,me.Width, me.headsection system.debuglog me.HeadSection.ToText

I see it still has a value of 40. Even quitting Xojo and reloading the project didn’t change anything.
I could fix it by assigning the new value in the open event to headsection, but that’s 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.

Is this property exposed via the inspector behavior and set to 40 in the inspector?

I was suspecting that too, but no, no inspector behavior. And I didn’t 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, it’s 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.

Could you test if this is new to 2016r1?

2015r4 does the same, so no.

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.

Thanks, @Antonio! Sounds to me like time for a feedback report – if I understood you right, @Joe, there’s none there yet for this issue?

Try to search for default or default value, I think to have read something related… or maybe it was in the forum.

I don’t remember seeing one, but I don’t remember a lot of things. It’d be best to file a case to ensure that there is at least one.

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)

<https://xojo.com/issue/42459>

Added a sample class (as text) before and after the property behavior is created (but never asked)

Been reported several times
Its not a bug

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”

Yes Norman, you are right.

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!