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 doSomething() it would have something like.

doSomething()
{
    widget.someOtherwidget.widget1.widget2.widget3.widget4.doStuff();
}

I am sure there is a better way to do this. Gregor's suggestion of an
observer pattern sounds about right.
Although there doesnt seem to be that much information that comes up
around implementing patterns in google when dealing with events in
objects unless you specifically look for it.

I'll have a search and come back here if i still have issues.


On Apr 7, 1:11 am, Jason Essington <jason.essing...@gmail.com> wrote:
> 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 about.
>
> -jason
>
> On Apr 4, 2009, at 8:51 PM, matttai wrote:
>
>
>
>
>
> > 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!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to