I am trying to add a new component within an existing component, but size the newly added component relative to the parent with setBoundsRelative().
The size of the new component is always relative to the width of the screen (1280, 800) rather than relative to the size of the parent component. My parent component’s size is 600 x 400. The newly created components size should be relative to 600 x 400. Not 1280 x 800.
I know this because I use getParentWidth() and getParentHeight() to print the parent component’s width and height, and they are the size of the desktop screen (1280, 800). Furthermore, the documentation for getParentWidth says:
How is the component being “on the desktop” (what does that mean?) just by virtue of adding it within a parent component? I mean, of course it’s on the desktop, this shouldn’t nullify the fact that it was created by my 600,400 parent component, right? When I add a tabbedComponent within the 600,400 parent, I can perfectly align the tabbedComponent’s height and width relative to the parent within resized(), and the tabbedComponent is on the desktop. Why can’t I add a component within the parent and do the same thing? I think I am just confused as to the semantic meaning of “on the desktop” within juce, and looking for some clarification, so I can get around this.
How do I tell juce that the new component is a child of the 600,400 component and not the 1280,800 desktop? This will then allow me to use setBoundsRelative() correctly.