Friday, November 25, 2011

Adding Buttons to DialogBox

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.

No comments:

Post a Comment