The strange behavior of the canvas width

hi everyone, I’m creating a simple game that creates a random number of squares aligned horizontally. I have used different methods and I wanted to try using (experimenting) the LineWidth method (I thought I would draw several vertical lines each with width = canvas width / square quantity).

In short, trying I saw that although in the properties the canvas width is “Fill parent” (image 0) in reality it is always 320pixel (image 1).
I tried to force to 640 pixels and it works (image 2).
I tried to force Set canvas width, you never know, to screen width "and it always responds with 320 pixels (image 3).
Am I missing something? Or did I skip a few steps?
PS: of course, I wrote the program using another method, but in this post I’m curious about the behavior of the canvas width.

Thanks everyone for the explanation!

It is probably just a timing issue:

This might help you with you app:

Many Thanks TIMAI2

2 posts were split to a new topic: Help with Ball in square game?