# Anchored at bottom and subtracted from height bug

**URL:** <https://forum.juce.com/t/anchored-at-bottom-and-subtracted-from-height-bug/13225>\
**Category:** The Projucer\
**Created:** [July 22, 2014, 6:31pm UTC](https://forum.juce.com/t/anchored-at-bottom-and-subtracted-from-height-bug/13225 "2014-07-22T18:31:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sophia](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@sophia](https://forum.juce.com/u/sophia)\
**Post date:** [July 22, 2014, 6:31pm UTC](https://forum.juce.com/t/anchored-at-bottom-and-subtracted-from-height-bug/13225/1 "2014-07-22T18:31:20Z")

</div>

Using the the Introjucer in JUCE 3.0.7, I am experiencing the following bug with a widget in a parent component:

&nbsp;

Y:

absolute distance from bottom of parent

anchored at bottom of component

&nbsp;

height:

subtracted from height of parent

&nbsp;

This results in the following Jucer markup:

pos="64 50Rr 66 278M"

&nbsp;

and the following generated C++ code:  
widget-\>setBounds (64, getHeight() - 50 - getHeight() - 278, 66, getHeight() - 278);  
  
Which results in my widget drawing outside the clip bounds of the parent component. &nbsp;The problem is one of order-of-operations in the Y position and could be solved with parenthesis:

widget-\>setBounds (64, getHeight() - 50 - (getHeight() - 278), 66, getHeight() - 278);

&nbsp;

I haven't tested, but I would guess that this same issue may have other similar bug recipes.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [July 23, 2014, 9:20am UTC](https://forum.juce.com/t/anchored-at-bottom-and-subtracted-from-height-bug/13225/2 "2014-07-23T09:20:59Z")

</div>

Ok, I've tweaked that code now - try it again!

---

<div class="post-metadata">

**Author:** ![sophia](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@sophia](https://forum.juce.com/u/sophia)\
**Post date:** [July 24, 2014, 5:20pm UTC](https://forum.juce.com/t/anchored-at-bottom-and-subtracted-from-height-bug/13225/3 "2014-07-24T17:20:57Z")

</div>

Yup, fixed now. &nbsp;Thank you!
