PDA

View Full Version : ToolTipConfig.setMaxWidth doesn't work



iyeh
15 Feb 2016, 11:37 AM
ToolTipConfig.setMaxWidth doesn't work.

The doc says default is 300. But when I setBody to a very long text. It sizes up to the browser window width before it wraps.

Explicitly setting it doesn't work either. The issue is seen on IE11 and Chrome.

margozzi
11 Oct 2016, 9:29 AM
I see the same. Not working.

branflake2267
11 Oct 2016, 1:38 PM
This is a defect. There is a workaround for the issue in the mean time.



import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.RootPanel;
import com.sencha.gxt.widget.core.client.container.CenterLayoutContainer;
import com.sencha.gxt.widget.core.client.container.Viewport;
import com.sencha.gxt.widget.core.client.tips.ToolTip;
import com.sencha.gxt.widget.core.client.tips.ToolTipConfig;


public class ToolTipMaxSizeTest implements EntryPoint {


@Override
public void onModuleLoad() {
ToolTipConfig config = new ToolTipConfig();
config.setTitle("This is for test");
config.setBody(
"The people came out of their houses and smelled the hot stinging air and covered their noses from it. And the children came out of the houses, but they did not run or shout as they would have done after a rain. Men stood by their fences and looked at the ruined corn, drying fast now, only a little green showing through the film of dust. The men were silent and they did not move often. And the women came out of the houses to stand beside their men - to feel whether this time the men would break. The women studied the men's faces secretly, for the corn could go, as long as something else remained. The children stood near by, drawing figures in the dust with bare toes, and the children sent exploring senses out to see whether men and women would break the children peeked at the faces of the men and women, and then drew careful lines in the dust with their toes. Horses came to the watering troughs and nuzzled the water to clear the surface dust. After a while the faces of the watching men lost their bemused perplexity and became hard and angry and resistant. Then the women knew that they were safe and that there was no break");
config.setMinWidth(300);
config.setMaxWidth(400);
config.setCloseable(true);


CenterLayoutContainer testContainer = new CenterLayoutContainer();
testContainer.add(new HTML("ONLY FOR TEST"));


ToolTip tip = new ToolTip(testContainer, config) {
@Override
public void setMaxWidth(int maxWidth) {
super.setMaxWidth(maxWidth);


getElement().getStyle().setProperty("maxWidth", maxWidth + "px");
}


@Override
public void setMinWidth(int minWidth) {
super.setMinWidth(minWidth);


getElement().getStyle().setProperty("minWidth", minWidth + "px");
}
};


Viewport viewport = new Viewport();
viewport.setWidget(testContainer);
RootPanel.get().add(viewport);
}


}