Hey matttai, did you find a good solution for your issue? I'm trying
to do something similar and have not had much luck. Observer pattern
would seem to be the way to go - In theory there is no difference
between theory and practice. In practice there is.;)
On Apr 6, 10:12 pm, matttai
the easiest way is to create a click handler that holds a reference to
the parent
the simplest form would look something like:
myWidget.addClickHandler(new ClickHandler(){
public void onClick(ClickEvent event){
parent.doSomething();
}
});
no need to do any sink/unsink mucking
Ah that works only if the widget is nested in 1 object (eg. direct
parent).
The widget is dynamically added to various objects and can be nested
at different levels.
Currently i am using a VERY dodge way of this.getParent().getParent
().getParent().getParent().doSomething(); :)
And in that
Still don't see the problem.
public class MyParentClass extends Composite implements ClickHandler
{
public void add(Widget w) {
super.add(w);
if (w instanceof MyChildClass) {
MyChildClass child = (MyChildClass) w;
Hi matttai,
unless you have a big reason to do so, I would avoid sinking/unsinking
events etc. I would go for one of two options:
1. if the inner widget is *only* ever used by the parent (owned by
parent only), then you can make it an inner class of the parent
widget. This is convenient since
As per the title :)
How to get internal widget to notify its parent widget when clicked
(and have the parent execute something)?
I think it has something to do with sinking and unsinking events but I
haven't been able to find a very good example of doing this.
Any help would be appreciated!