I've add a hoverhandler code to a widget that gets the help from a DB.
Which work fine, but the first time it does't show the hover text. I have to move the mouse cursor off and then on to the widget, to let the hover text show.
I've tried several things to force the hover text to show the first time, but nothing worked.
Is there a way to show the hover text the first time ?
Code:
final HelpDS helpDS = HelpDS.getInstance(); ((Canvas) widget).addHoverHandler(new HoverHandler(){ @Override public void onHover(final HoverEvent event) { String t = ((Canvas) widget).getPrompt(); if(t==null){ Criteria crit = new Criteria(); crit.addCriteria("helpid", helpid); helpDS.fetchData(crit, new DSCallback(){ @Override public void execute(DSResponse response, Object rawData, DSRequest request) { JsArray<JavaScriptObject> arrJso = ((JavaScriptObject) rawData).cast(); if(response.getStatus()==0){ final String help = JSOHelper.getAttribute(arrJso.get(0), "help"); ((Canvas) widget).setPrompt(help); //((Canvas) widget).fireEvent(new HoverEvent(null)); // new Timer(){ // @Override // public void run() { // //((Canvas) widget).setPrompt(help); // ((Canvas) widget).fireEvent(new HoverEvent(null)); // } // }.schedule(500); DeferredCommand.addCommand(new Command(){ @Override public void execute() { //((Canvas) widget).setPrompt(help); ((Canvas) widget).fireEvent(new HoverEvent(null)); } }); } }}); } } });
I've tried several things to force the hover text to show the first time, but nothing worked.
Is there a way to show the hover text the first time ?