You should rather encapsulate your context menu logic in a PopupMenu or ContextMenu class. Something like this may help:
public class ContextMenu extends PopupPanel { private final ClickListener closeListener = new ClickListener() { public void onClick(final Widget sender) { hide(); } }; private final MouseListener rolloverListener = new MouseListenerAdapter() { public void onMouseEnter(final Widget sender) { for(final Widget widget : items) { if(widget == sender) { widget.addStyleDependantName("Hover"); } else { widget.removeStyleDependantName("Hover"); } } } }; private final VerticalPanel items = new VerticalPanel(); public ContextMenu() { super(true, false); setWidget(items); addStyleName("ContextMenu"); } public SourcesClickEvents addItem(final String displayText) { final Label label = new Label(displayText); label.setStylePrimaryName("ContextMenu-Item"); label.addClickListener(closeListener); label.addMouseListener(rolloverListener); items.add(label); return label; } public void show(final Widget parent, final int x, final int y) { setPopupPositionAndShow(new PositionCallback() { public void setPosition( final int width, final int height) { int px = parent.getAbsoluteLeft() + x; int py = parent.getAbsoluteTop() + y; if(px + width > Window.getClientWidth()) { px = Window.getClientWidth() - width; } if(py + height > Window.getClientHeight()) { py = Window.getClientHeight() - height; } ContextMenu.this.setPosition(px, py); } }); } } The above class adds Labels with a ClickListener to close the PopupPanel and a MouseListener to handle rollover (Hover) styles. You can use addItem("Delete This").addClickListener(new ClickListener() { public void onClick(Widget sender) { currentItem.delete(); } }); to add your actual handling ClickListener to the Labels. Hope that helps a bit. ArunDhaJ wrote: > I've tried... > RootPanel.get().remove(sender.getParent().getParent().getParent()); > and removed it. But once I remove this way, it gets permanantly > removed and menu doesnt appear once again. > > I've even tried > sender.getParent().getParent().getParent().setVisible(false); > the same problem as above persists.. once hidden its not coming up > again... > > Regards > ArunDhaJ > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---