This content has been marked as final. Show 4 replies
anybody? is there any way to get the x and y coordinates of the components inside the h box?
cuz i could find out which one has the highest y value and set that as the hbox's Height
I don't quite understand what you are trying to do, especially since the HBox is horizontal and won't expand downward, just to the right. If you place the HBox into a container that can do absolute positioning (like Application) you set the HBox's bottom="0" and it will always remain anchored to the bottom of the container. With HBox, if you do not specify a width, it will always resize to fit its content. As you add more contents it will expand to the right. If it extends beyond the Application's boundaries, the Application will acquire scrollbars. If you set the HBox's size, then the HBox will get the scrollbars.
I had a similar problem with a container control (VBox) that hosted a datagrid. The requirement was that the grid will not have a vertical scrollbar by itself but the container control does. In other words, I had to make sure that the datagrid's height is set dynamically just exactly to the value required to display all content, not more and not less.
I found the best solution to be a method that resizes the datagrid like this:
this.dg1.height = this.dg1.measureHeightOfItems(-1, _myDataSource.length);
The method gets called whenever the data is set from outside via a public function.
There might be some easier way of playing with absolute and relative values for height, maxHeight etc. but I found this to be the easiest way. Maybe you can adapt this to your needs.
Hope this helps,
Thanks guys for your solutions!! I played around with both of your ideas, seeing if I should do it programmatically or by the Hbox's properties.
The final solution was to set the right="0" and bottom = "0" for the hbox and it fixed it!
makes it so it uses the browsers scrollbars and not the hbox's :)