Cannot change WebButton width during runtime in 2020r1

With Web 2.0 I am trying to adjust the dimensions of a WebButton during Runtime.

First, using the Lock properties seemed to have no effect on the size (neither Width nor Height), only on the position. The size is stuck on the IDE values.

Next, changing the Height property actually changed the height, but not the display. It was stuck at 38px. I did discover that the height could be changed through the WebStyle.Value(“height”) function. So that was solved.

Then I tried to change the Width property, but nothing changed. I then tried the same trick as above by using the WebStyle.Value(“width”) function. But no luck. I cannot change the width during runtime under any method I could think of (LockRight+LockLeft, nor Width property nor WebStyle.Value function).

So, please help me pointing out what I’m missing.

Are you using Button1.Width = 200
Can you post the code that you tried to change the Button width?

Create an new empty web project. Add a WebButton to the page. In the Pressed event place the following code. The caption does change as expected, but the display of the button does not modify. Even if you move the cursor around the button it changes appropriately but the actual displayed width is not affected

static flag as boolean

flag = not flag

if flag then
me.Width = 200
me.Width = 50
end if
me.Caption = Str(me.Width)

After playing around with some variations, it turns out a button cannot change its own width. It does change the width of other buttons.

That sounds like a bug to me. Any comments?


The problem is in the Caption change. If the caption is not changed, the button’s width can be changed without problems.

Changing the Caption resets the Button to the original width, height, top, left set in the IDE.

Edit: reported here feedback://showreport?report_id=61757


Changing the Indicator after the buttons changed position/size also resets the button position/size to IDE set values.