Hi guys,
I am seeing an issue determining the height of elements that contain HTML. For example a typical situation could be this:
This produces a red label with a height of ~60 pixels, with the text placed in the middle.
I found a simple solution by setting the following option:
Which works well for text, the label wraps nicely on the text without extra paddings. However when I enter HTML things change:
The result is that the label is once again too large. When inspecting with firebug I noticed the H1 'test' text to be 20 pixels, but the Label element much larger at 52 pixels. There are no padding or margins set, the extra spacing seems to be the result of the label calculating the wrong height for its contents.
I have tried various other elements, like HTMLFlow or HTMLPane. They all seem to have this issue. Also using different HTML items the size of the Label differs, especially images or styled text seem to be a factor in the size of the element. In all cases the Label is too large though, I have not yet seen it being too small.
Is there a way to make the label wrap closely to the HTML contents? Without explicitly setting a height on the label element: I cannot predict the size of the contents.
I am working with the latest nightly build: SNAPSHOT_v8.3d_2012-10-11/LGPL Development Only (built 2012-10-11), using Firefox in develop mode. Also when building a war and deploying on tomcat this behavior appears.
Thanks!
[edit]
Apologies, I am of course talking about Smart GWT. Could somebody move this thread to the right subforum? Thanks!
I am seeing an issue determining the height of elements that contain HTML. For example a typical situation could be this:
Code:
VLayout vlayout = new VLayout(); Label fitLabel = new Label(); fitLabel.setContents("TEST"); fitLabel.setBackgroundColor("#FF0000"); vlayout.addMember(fitLabel);
I found a simple solution by setting the following option:
Code:
fitLabel.setAutoHeight();
Code:
fitLabel.setContents("<h1>TEST</h1>");
I have tried various other elements, like HTMLFlow or HTMLPane. They all seem to have this issue. Also using different HTML items the size of the Label differs, especially images or styled text seem to be a factor in the size of the element. In all cases the Label is too large though, I have not yet seen it being too small.
Is there a way to make the label wrap closely to the HTML contents? Without explicitly setting a height on the label element: I cannot predict the size of the contents.
I am working with the latest nightly build: SNAPSHOT_v8.3d_2012-10-11/LGPL Development Only (built 2012-10-11), using Firefox in develop mode. Also when building a war and deploying on tomcat this behavior appears.
Thanks!
[edit]
Apologies, I am of course talking about Smart GWT. Could somebody move this thread to the right subforum? Thanks!