Bug with relative positioning


#1

Here’s the scenario:

I have a ListBox, MyListBox. The ListBox has labels directly above it. There are some buttons above and below MyListBox, and they have a fixed size, but the ListBox itself has a height relative to the height of the component so that resizing the component will expand the room in the ListBox. There are actually several labels above MyListBox which correspond to columns of data, so I made the bounds for all the labels relative to MyListBox. This is the way it shows up in The Jucer:

[code]/---------------------------\

MyComponent
MyLabel
_________________________

---------------------------/[/code]

MyListBox y = 168px (relative to parent component)
MyListBox height = 372px (subtracted from height of parent)

MyLabel y = -24px (absolute distance from top of MyListBox)
MyLabel height = 24px (absolute, relative to MyListBox)

I just did it this way for consistancy (having every bound of the labels relative to MyListBox). Obviously an absolute height shouldn’t matter one way or the other what it’s relative to. Everything looks fine in The Jucer, and when I use “Test component” it looks fine, but when I actually run the app, I get:

[code]/---------------------------\

MyComponent
/////////
/////////________________
/////////
/////////
/MyLabel/
/////////
/////////____________
/////////

---------------------------/[/code]

The bounds of MyLabel are totally covering the ListBox, so that I can’t click on anything in the ListBox. The actually problem is that code being generated by The Jucer sets the height of MyLabel as:

So what “Absolute height” is actually doing should be called “Added to height of MyListBox”.

Obviously this is easy for me to work around, but it’s definitely a bug, since it shows up correctly in The Jucer but then breaks when the code is actually generated (I find it interesting that the code generated for testing the component can actually be so different from the actual code generated).


#2

Looks like just a bugette in the testing code - I’ve checked in a new version now if you want to try it…