I should add setTitle(...) won't work for me because my app is a firefox extension that shows in a sidebar, and there's a firefox bug where title tooltips don't show. Also, I'd like to potentially add more functionality to the popup widget.
On Dec 19, 12:02 pm, otismo <[email protected]> wrote: > How can I sink mouse events for options in a list box? I know the > browser generates the mouse events on option elements because I've > tried it manually, but I can't get it to work within gwt. Ultimately > I'm trying to generate tooltips for each item in alistbox. > > Here's the code that doesn't work: > > private class TopicsListBox extendsListBoximplements EventListener { > ... > protected void addTopic(TopicLink topic) { > addItem(topic.getName()); > int lastIndex = getItemCount() - 1; > OptionElement option = getOptionElement(lastIndex); > com.google.gwt.user.client.Element castOption = > (com.google.gwt.user.client.Element) option.cast(); > DOM.setEventListener(castOption, this); > DOM.sinkEvents(castOption, Event.MOUSEEVENTS); > > } > > public void onBrowserEvent(Event event) { > Element optionElement = event.getTarget(); > switch (event.getTypeInt()) { > case Event.ONMOUSEOVER: > showTooltip(optionElement); > break; > case Event.ONMOUSEOUT: > cancelTooltip(optionElement); > break; > } > > } > > Can anyone give me some tips? > > Thanks, > Peter --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
