Stretched canvas

After I enter data in the text box, the canvas appears stretched. I put the Update Canvas button just to see how the canvas should appear after TextBox1.HideKeyboard.
How can I update the canvas without using a button after TextBox1.HideKeyboard?

CanvasDistortion.aia (20.5 KB)

Try this version:

CanvasDistortion (1).aia (20.4 KB)

Value functions are more reactive than global variables.

Thanks, but does not work. Same issue.

Try this

CanvasDistortionWithClock.aia (20.7 KB)

Thanks but no. Does not work.

Sorry, left out the ClockTimer enabled block here


I never thought that such a simple task needed a timer. It's fine now, thanks. I learned something today.
There's a bit of a delay, but I'll probably have to settle for that.
I was thinking of a hidden button, but there is no HiddenButton.PerformClick() to simulate button click to create an external event.

The reason for the clock timer is that the blocks (e.g. your init procedure) are initiated and run faster than the canvas is drawn and gets its sizing. So you have to give the canvas a little time to sort itself out before getting values from the canvas width and height.

You can try reducing the clock time. I tried with 100ms but that was too quick so for expedience went for 250ms.

1 Like

150ms is fine for me. But I don't know how it will behave on other phones. I will do some tests.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.