Hi folk,
I am having a strange issue, and I am thinking that this is a bug in SmartGWT.
I want to return a custom canvas in the override getHoverComponent() method by passing the custom canvas from another method, when I returned HLayout it works fine every time, now When I returned an HLayout that contains a members for example button the first time every thing is OK but on other times the members are disappeared only the HLayout appears.
Please see the code below, also see the picture attached to this thread.
I am having a strange issue, and I am thinking that this is a bug in SmartGWT.
I want to return a custom canvas in the override getHoverComponent() method by passing the custom canvas from another method, when I returned HLayout it works fine every time, now When I returned an HLayout that contains a members for example button the first time every thing is OK but on other times the members are disappeared only the HLayout appears.
Please see the code below, also see the picture attached to this thread.
Code:
import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.ImgButton; public class TestImgButton extends ImgButton { boolean havCanvas = false; private Canvas customCanvas ; public TestImgButton(){ super(); } @Override public Canvas getHoverComponent() { if(havCanvas){ return customCanvas ; } else{ return null; } } //set tool tip canvas with out any style. public void setTooltipContent( Canvas customCanvas){ havCanvas = true; this.customCanvas=customCanvas; } }
Code:
public class Test implements EntryPoint { public void onModuleLoad() { HLayout hLayout = new HLayout(); hLayout.setBackgroundColor("#FF0000"); hLayout.setSize("100", "150"); Button testButton = new Button("Test"); testButton.setWidth(50); testButton.setHeight(50); hLayout.addMember(testButton); TestImgButton testImgBtn = new TestImgButton(); testImgBtn.setWidth(100); testImgBtn.setHeight(100); testImgBtn.setCanHover(true); testImgBtn.setShowHover(true); testImgBtn.setShowHoverComponents(true); testImgBtn.setTooltipContent(hLayout); testImgBtn.draw(); } }
Comment