Sunday, November 27, 2011

Re: Adding Buttons to DialogBox

Any reason you're using DOM and Element to do this? Why not just
setWidget(2,1,okButton)?

Vid

On Fri, Nov 25, 2011 at 7:37 AM, John Maitland
<jfgmaitland@googlemail.com> wrote:
> Could anyone suggest why the Click Event doesn't fire in the following
> example code?
>
> Many thanks
>
> John
>
> public class OKDialog extends DialogBox {
>
>    public OKDialog() {
>
>        Button okButton = new Button("OK");
>
>        //add a button in dialogBottomCenterInner div
>        Element bottomMiddle = getCellElement(2, 1);
>
>        okButton.removeFromParent();
>        remove(okButton);
>
>        // Add the buttons to the top row of the decorator panel. We
> need to
>        // logically adopt the caption so we can catch click events.
>        DOM.appendChild(bottomMiddle,
> okButton.asWidget().getElement());
>        adopt(okButton.asWidget());
>
>        okButton.addClickHandler(new ClickHandler() {
>            @Override
>            public void onClick(ClickEvent event) {
>                GWT.log("Clicked!");
>            }
>        });
>   }
> }
>
> --
> 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+unsubscribe@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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment