# Get calculated width/height block

**URL:** <https://community.thunkable.com/t/get-calculated-width-height-block/514243>\
**Category:** Questions about Thunkable X\
**Created:** [March 14, 2020, 7:29am UTC](https://community.thunkable.com/t/get-calculated-width-height-block/514243 "2020-03-14T07:29:46Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![hhuman](https://avatars.discourse-cdn.com/v4/letter/h/3be4f8/32.png) [@hhuman](https://community.thunkable.com/u/hhuman)\
**Post date:** [March 14, 2020, 7:29am UTC](https://community.thunkable.com/t/get-calculated-width-height-block/514243/1 "2020-03-14T07:29:46Z")

</div>

What exactly does the Get Calculated Height or Width of element block give you? I can’t figure it out and not finding any info in searches. It gives a number with decimals… for example… a row that is 50% of screen which is 320px, returns a value of 89.66666412353516

Anybody can clarify??

 ![Screenshot_2020-03-14-03-10-03](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/1/51bed8d85fbac83e6cd482c03de54d0795e94b3b.png)

---

<div class="post-metadata">

**Author:** ![eoinparkinson](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eoinparkinson/32/143769_2.png) [@eoinparkinson](https://community.thunkable.com/u/eoinparkinson)\
**Post date:** [March 14, 2020, 9:23am UTC](https://community.thunkable.com/t/get-calculated-width-height-block/514243/2 "2020-03-14T09:23:10Z")

</div>

There doesn’t seem to be anything in docs, though I’ve only noticed this feature lately.

[This](https://developer.mozilla.org/en-US/docs/Web/CSS/computed_value) might be of help to understanding this.

I believe web and mobile app development terms go hand in hand. Eg. Padding and margin both mean the same in web and app development.

My guess is that the link above may roughly/correctly explain the computed height/width block. But I’m sure a more knowledged member of the community will have an answer here for us. 🙂

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [March 14, 2020, 9:44am UTC](https://community.thunkable.com/t/get-calculated-width-height-block/514243/3 "2020-03-14T09:44:42Z")

</div>

These blocks return the client dimensions of the screen area. For example, the screen resolution of my device is 360 x 780, and blocks will return 360 x 711, because at the top and bottom of the screen there are system panels that reduce the height available for the app.

---

<div class="post-metadata">

**Author:** ![hhuman](https://avatars.discourse-cdn.com/v4/letter/h/3be4f8/32.png) [@hhuman](https://community.thunkable.com/u/hhuman)\
**Post date:** [March 14, 2020, 4:41pm UTC](https://community.thunkable.com/t/get-calculated-width-height-block/514243/4 "2020-03-14T16:41:27Z")

</div>

Hey man, thanks for trying to help me figure this out. I’m still not clear after checking out that link. Still doesn’t make sense to me, at least according to the numbers I posted…

---

<div class="post-metadata">

**Author:** ![hhuman](https://avatars.discourse-cdn.com/v4/letter/h/3be4f8/32.png) [@hhuman](https://community.thunkable.com/u/hhuman)\
**Post date:** [March 14, 2020, 4:42pm UTC](https://community.thunkable.com/t/get-calculated-width-height-block/514243/5 "2020-03-14T16:42:57Z")

</div>

So how come it’s giving me a value of 89.66666412353516 for 320px?

---

<div class="post-metadata">

**Author:** ![libermancsgz8](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/libermancsgz8/32/61005_2.png) [@libermancsgz8](https://community.thunkable.com/u/libermancsgz8)\
**Post date:** [March 31, 2020, 6:24pm UTC](https://community.thunkable.com/t/get-calculated-width-height-block/514243/6 "2020-03-31T18:24:25Z")

</div>

I think I have a workaround.  
Use 2 sprites to calculate the width and the height using a while loop and the edge reached event block.  
Then you can use your variables to get the actual height and width of the canvas.

 ![Screen Shot 2020-03-31 at 11.09.02 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/7/f7782c7441a9ee87d5e1edea3d0e32c2def1a4fe.png)

---

<div class="post-metadata">

**Author:** ![hhuman](https://avatars.discourse-cdn.com/v4/letter/h/3be4f8/32.png) [@hhuman](https://community.thunkable.com/u/hhuman)\
**Post date:** [March 31, 2020, 6:40pm UTC](https://community.thunkable.com/t/get-calculated-width-height-block/514243/7 "2020-03-31T18:40:51Z")

</div>

Can you explain to me what this does?

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [March 31, 2020, 6:43pm UTC](https://community.thunkable.com/t/get-calculated-width-height-block/514243/8 "2020-03-31T18:43:59Z")

</div>

An you post a screenshot of the results?! Great work!

Could you also post a share link of just that screen?

---

<div class="post-metadata">

**Author:** ![libermancsgz8](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/libermancsgz8/32/61005_2.png) [@libermancsgz8](https://community.thunkable.com/u/libermancsgz8)\
**Post date:** [March 31, 2020, 6:56pm UTC](https://community.thunkable.com/t/get-calculated-width-height-block/514243/9 "2020-03-31T18:56:58Z")

</div>

So I started out both sprites in the top left corner.  
The sprite then moves 1 pixel to the right and records how many pixels it moves (variable canvasHeight and canvasWidth) until it hits the edge (That is what the while loop does, it stops doing this in the collides with edge event.)  
While loops keep working until the statement changes (which happens when an edge is hit)

I did the same for the height.  
For testing purposes, I spit the values on the label to see if it works.  
In the test screen, the canvas height is 380 and the width is 227. I’m going to use those values to move the mushroom around the canvas randomly.

Looks like it works because I get different values on my iPhone screen.

 ![Screen Shot 2020-03-31 at 11.37.52 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/4/f4ab4ff94b0f9510e83bad50ac2fa13e54064764.png)

---

<div class="post-metadata">

**Author:** ![hhuman](https://avatars.discourse-cdn.com/v4/letter/h/3be4f8/32.png) [@hhuman](https://community.thunkable.com/u/hhuman)\
**Post date:** [March 31, 2020, 7:15pm UTC](https://community.thunkable.com/t/get-calculated-width-height-block/514243/10 "2020-03-31T19:15:41Z")

</div>

Wow, that is so cool!! Thanks for sharing this!!

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 11:39am UTC](https://community.thunkable.com/t/get-calculated-width-height-block/514243/11 "2024-11-08T11:39:32Z")

</div>


