I have a horizontal navigation bar with several Labels acting as links. I would like it so that when the user rolls over a Label, a menu appears and the user can choose a sub-link (like the navigation of the smartclient.com site).
I can get the menu to show but I can't get it to hide when I mouse out of the label. The dev console shows the mouse out events occurring too. Also, I noticed that none of the other label rollovers work when a menu is shown.
I also tried setting the mouse out handler on the menu, which worked in that I had to mouse over the menu and then out of it. But if I mouse over just the label then mouse over to the adjacent label (w/o going into the menu), nothing happens.
It seems like showing the menu is blocking other handlers on the labels from executing.
This is my code:
I can get the menu to show but I can't get it to hide when I mouse out of the label. The dev console shows the mouse out events occurring too. Also, I noticed that none of the other label rollovers work when a menu is shown.
I also tried setting the mouse out handler on the menu, which worked in that I had to mouse over the menu and then out of it. But if I mouse over just the label then mouse over to the adjacent label (w/o going into the menu), nothing happens.
It seems like showing the menu is blocking other handlers on the labels from executing.
This is my code:
Code:
label.addMouseOverHandler(new MouseOverHandler() { @Override public void onMouseOver(MouseOverEvent event) { Log.debug("label onMouseOver"); menu.showNextTo((Canvas) event.getSource(), "bottom"); } }); label.addMouseOutHandler(new MouseOutHandler() { @Override public void onMouseOut(MouseOutEvent event) { Log.debug("label onMouseOut"); // never displayed menu.hide(); } });
Comment