PDA

View Full Version : [1.2.4] Tooltip is hiding context menu



sdc
9 Jul 2009, 5:33 AM
Hosted mode
Windows XP
GWT 1.5.3
GXT 1.2.4 (maybe also 2.0?)

When you set a context menu and a tooltip on a component and you right click on the component, the tooltip is partially hiding the context menu.


public class TestToolTipAndMenu implements EntryPoint {

public void onModuleLoad() {
DataList list = new DataList();
DataListItem item = new DataListItem("My item");
item.setToolTip("My item tooltip");
list.add(item);
Menu menu = new Menu();
menu.add(new MenuItem("My menu item"));
list.setContextMenu(menu);
RootPanel.get().add(list);
}

}I don't know if this is the cleaner way to fix it, but you could hide the tooltip when you show the context menu. In Component :

protected void onShowContextMenu(int x, int y) {
hideToolTip();
contextMenu.showAt(x, y);
if (contextMenu.isVisible()) {
contextMenu.addListener(Events.Hide, new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent ce) {
contextMenu.removeListener(Events.Hide, this);
onHideContextMenu();
}
});
disableBrowserEvents = true;
}
}

sdc
9 Jul 2009, 5:40 AM
My fix won't work. In the sample, the context menu is a data list attribute while the tooltip is a data list item attribute.

sdc
9 Jul 2009, 5:42 AM
As a workaround, I do :

contextMenu.addListener(Events.BeforeShow, new Listener<MenuEvent>(){
public void handleEvent(MenuEvent be) {
DataListItem selectedItem = references.getSelectedItem();
if (selectedItem != null) {
selectedItem.hideToolTip();
}
}});

sven
9 Jul 2009, 6:26 AM
I would not count this as a bug. You can define the hidingtime of the tooltip to hide asap. You could also define a higher zIndex for the menu, so that the menu is on top.

sdc
9 Jul 2009, 6:43 AM
Well, if the menu is on top, then you will partially see the tooltip.

I don't expect to see both tooltip and context menu. I would expect the tooltip to be hidden when I open the context menu or even when I just click anywhere, like in many other apps (try a right - or left - click on an icon in your personal bar in Firefox or try on icons in your Windows XP desktop or explorer)

sven
9 Jul 2009, 6:55 AM
You can configure your tooltip to hide asap when the mouse leaves

sdc
9 Jul 2009, 7:33 AM
You can configure your tooltip to hide asap when the mouse leaves

Yep, I know that but when you (left or right) click on the component, it doesn't hide the tooltip, while many other apps do.

sdc
10 Jul 2009, 9:28 AM
So, this is a "WONTFIX" issue ?