This is what I am using, you can put anything inside the PopupButton and it will be the popup content.
/** * How to use: * <j:PopupButton ui:field="settings" text="Tools ▼"> <g:HTMLPanel visible="false"> <div class="P5"><a href="#!settings">Settings</a></div> <div class="P5"><a href="#!logout">Logout</a></div> </g:HTMLPanel> </j:PopupButton> */ public class PopupButton extends Composite implements HasWidgets { private final Button button = new Button(); private Element target; private boolean targetVisible = false; protected HandlerRegistration registration; private final NativePreviewHandler handler = new NativePreviewHandler() { @Override public void onPreviewNativeEvent(NativePreviewEvent event) { if (event.getTypeInt() == Event.ONMOUSEDOWN) { Element eventTarget = event.getNativeEvent().getEventTarget() .cast(); if (!target.isOrHasChild(eventTarget)) { hide(); } } } }; public void setText(String text) { button.setText(text); } public PopupButton() { initWidget(button); button.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (targetVisible) { targetVisible = !targetVisible; target.getStyle().clearDisplay(); registration = Event.addNativePreviewHandler(handler); } else { hide(); } } }); } private void hide() { targetVisible = !targetVisible; target.getStyle().setDisplay(Display.NONE); if (registration != null) { registration.removeHandler(); } } @Override public void add(Widget w) { if (target != null) { throw new RuntimeException("You can only add one widget"); } RootPanel.get().add(w); target = w.getElement(); hide(); } @Override public void clear() { throw new RuntimeException(); } @Override public Iterator<Widget> iterator() { throw new RuntimeException(); } @Override public boolean remove(Widget w) { throw new RuntimeException(); } @Override protected void onLoad() { Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { target.getStyle().setTop(button.getOffsetHeight() + button.getAbsoluteTop(), Unit.PX); target.getStyle().setLeft(button.getAbsoluteLeft(), Unit.PX); target.getStyle().setZIndex(10000); target.getStyle().setPosition(Position.ABSOLUTE); } }); } } On Mon, Mar 14, 2011 at 5:15 PM, Marco Gadaleta <gadaleta.ma...@gmail.com>wrote: > ? > > > On Mon, Mar 14, 2011 at 9:12 PM, Juan Pablo Gardella < > gardellajuanpa...@gmail.com> wrote: > >> +1 >> >> 2011/3/14 Marco Gadaleta <gadaleta.ma...@gmail.com> >> >>> Nothing??? >>> >>> On Wed, Mar 9, 2011 at 1:53 PM, gadaleta.marco <gadaleta.ma...@gmail.com >>> > wrote: >>> >>>> hello everyone, >>>> there a way to create a button in gwt like "gmail more actions" button >>>> without using external library? >>>> Thx, hope you can help me. >>>> >>> >>> >>> >>> -- >>> Marco >>> >>> -- >>> 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 >>> google-web-toolkit+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/google-web-toolkit?hl=en. >>> >> >> -- >> 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 >> google-web-toolkit+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/google-web-toolkit?hl=en. >> > > > > -- > Marco > > -- > 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 > google-web-toolkit+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/google-web-toolkit?hl=en. > -- Guit: Elegant, beautiful, modular and *production ready* gwt applications. http://code.google.com/p/guit/ -- 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 google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.