views:

33

answers:

1

Hi,

I have a horizontalpanel with 3 verticalpanels inside. In the verticalpanels there are custom widgets

I need all verticalpanels has the same height (even if they have different number of widgets inside) and a button in the empty space.

So, I put all panels height = 100% and the buttons height = 100%.

The problem is that the verticalpanel cells height are bigger than my widgets, so it left a space between all verticalpanels widgets.

Here is an example

How can I adjust the verticalpanels cells height to my widgets height. My widgets are not images like in the example, so i can't know the widgets height.

I have a lot of time in this problem, anyidea will help Thx!!!!

+1  A: 

Haven't tried it, but this should work or at least give you something to start:

VerticalPanel.setCellHeight(yourWidget, Integer.toString(yourWidget.getElement().getOffsetHeight())+"px");

What it does: setCellHeight() sets the height of the cell the widget is in you pass to the function.
The second parameter in the function is the height of that cell. This gets a little tricky because you don't know the height.
With the getElement() you get the Element of that widget in the DOM of the browser, on that element you can call getOffsetHeight().
getOffsetHeight() returns an integer so you need to cast it into a String and concatenate "px" to it so the browser knows it's pixel and not em or something like that.

Chris Boesing
thx, with getOffsetHeight I can get the widgets height. But if I use it after add the widget to the panel the height is 0px. If I use the method in the onLoad() it calculates the height of the widget but before it applies the style.When I should use the method to get the widget height after it applies the style???thx again!!!
david