I have an app with two labels and a canvas:
The size of the canvas is set to "fill parent" on both the width and the height.
In the blocks section i set the width and height of the canvas to be the same as the screen width and then write these values to the two labels:
![Blocks](https://community.appinventor.mit.edu/uploads/default/original/3X/2/d/2d57a81e51014bc94e0107b839d801c1922d55cc.png)
When I run the app, the size is not being set as I would expect it to: the labels display the size of the canvas without changing the size:
What is the problem here?
TIMAI2
2
Use a clock timer to give the screen a little bit of time to get its own size, before trying to change the canvas size. 250ms is usually enough time.
1 Like
I even tried waiting for the size to change by changing the code this way:
![Loop](https://community.appinventor.mit.edu/uploads/default/original/3X/3/1/3188cab390487289839f67e4ffb0b7bb6c65785b.png)
The loop never finishes.
Try as @TIMAI2 suggested with a clock component
![image](https://community.appinventor.mit.edu/uploads/default/original/3X/e/7/e7709853c82deebf0206d92273fdf69641a068cc.png)
ABG
5
See FAQ Section: Waiting and Timing
for why you should not loop like that.
When I was playing with the canvas component, I was experiencing the same thing. The clock component helped, so follow Tim's suggestion.
system
Closed
7
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.