Solved. Looks like it actually does work, just not in the gwt hosted
mode browser.
Also, I added a custom attribute to the option elements that I use to
retrieve the tooltip text. To recap:
private class TopicsListBox extends ListBox {
...
protected void addTopic(TopicLink topic) {
addItem(topic.getName());
int lastIndex = getItemCount() - 1;
OptionElement option = getOptionElement(lastIndex);
option.setAttribute(TOOLTIP_ATTRIBUTE_NAME, topic.getTooltipText
());
option.setDisabled(!topic.isAvailable());
com.google.gwt.user.client.Element castOption =
(com.google.gwt.user.client.Element) option.cast();
DOM.sinkEvents(castOption, Event.MOUSEEVENTS | DOM.getEventsSunk
(castOption));
}
public void onBrowserEvent(Event event) {
super.onBrowserEvent(event);
Element optionElement = event.getTarget();
switch (event.getTypeInt()) {
case Event.ONMOUSEOVER:
showTooltip(optionElement);
break;
case Event.ONMOUSEOUT:
cancelTooltip(optionElement);
break;
}
}
private void showTooltip(Element optionElement) {
String text = optionElement.getAttribute(TOOLTIP_ATTRIBUTE_NAME);
tooltip = new Tooltip(optionElement, text);
tooltip.showTip();
}
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---