Bug while trying to move text?

Hi again team, I’m pretty sure I’ve hit another bug.

Create a web app with a button and a label.

Put the following in an action event:

label.text = “test”
label.left = 100

The text will change, but the label will not move.
Comment out the text change and it will move.

Should I file a bug?

Seems like it.

I’m curious, what if you switch the order of those lines?

Hi Kem.

Doesn’t seem to matter what order. Text just doesn’t want to move.

I think it is related to case 61757
If you don’t change the .text then the label position is changed.

For me the bug is that: if you change some properties for the control (like text/caption) the control is reset to what was set using the IDE.

You can test my theory by creating a new web app with 1 label and 2 buttons. Put label1.left = 100 in Button1 and label1.text = “test” in Button2 pressed event, run, click button 1 and the label will move to left 100, click button2 and the label text change to “test” and it returns to the position set by the IDE.

Hacky McHackyinson hack to get this working (at least it’s what I did):

Add a porperty to the page and store the position of the label then when you change the .text value do something like this:

label1.Text = "Back?"
label1.Left = labelYPosition

This is not a soulution but a workaround and not without it’s problems as I can still some times see the label flash in it’s original position and then move to the desired .Left value

Thanks all,

This indeed appears to be the bug. I note that it was discovered some time ago and still not fixed. Hopefully this fundamental problem can be sorted quickly. I didn’t seem to have much luck updating the browser Hector, why does it work with a property on the page and not hard coding it like:

label1.Text = “Back?”
label1.Left = 200

What version of Xojo are you using? Where are you putting the code?
I put your code in a button (to change the label) and it works.
I put your code in label Shown event and it works.
I put your code in label Opening event and it doesn’t change anything, not the text, nor the position (maybe a different bug here?).

If I put the .Text in the Opening event and .Left and .UpdateBrowser in the Shown event for the Label, it also works, but you see how the label is changed to “Back?” in the original position and then moves to Left 200.

1 Like

It will work without it having to be a property of the page, I’m just using a porperty since I set the value somewhere else in the code and this way I have access to it anywhere I need it.