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?
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.