Reputation: 2952
I'm trying to capture the button click event on a button within a subwindow, to be handled by the parent. The parent component (this) implements ClickListener
Window newWindow = new Window("test");
MyComponent myComponent = new MyComponent();
newWindow.setContent(myComponent);
newWindow.setModal(true);
myComponent.saveBtn.addClickListener(this);
UI.getCurrent().addWindow(newWindow);
I get the following error:
The method addClickListener(ClickListener) in the type FocusWidget is not applicable for the arguments (this)
Is there some other method for capturing events in sub windows that I'm missing?
Upvotes: 0
Views: 531
Reputation: 776
You are likely importing com.google.gwt.user.client.ui.Button not com.vaadin.ui.Button. You can't add Vaadin ClickListener to GWT Button or vice versa.
Listening to button click events works in sub-windows just as everywhere else. So your code should otherwise be OK as long as 'this' really is implementing the correct interface.
Upvotes: 1