Is there a particular reason you recommend this approach as opposed to using
the HTML widget?  For something as simple as this, it seems like overkill to
build-up a whole widget wrapping this when it doesn't seem to offer anything
over using HTML.

On Thu, Apr 16, 2009 at 5:07 AM, Thomas Broyer <t.bro...@gmail.com> wrote:

>
>
>
> On 16 avr, 07:01, dayre <david.c.a...@gmail.com> wrote:
> > Vitali, this looks fairly straight forward... but now i'm having
> > trouble wrapping this with a Composite so i can create my "clickable
> > list" wiget.    The issue is the HTML.wrap() which gives me an
> > exception due to the element not being attached to the DOM ?... i'm
> > missing something, but it's not apparent to me what it is and i'm
> > having problems finding any solid examples in this list.
> >
> > Would you be so kind as to provide a version of your code wrapped in a
> > class that extends Composite ?
>
> Instead of using the HTML widget and its wrap() method, extend Widget
> (and implements HasClickHandlers) and call the setElement from your
> ctor.
>
> class MyList extends Widget implements HasClickHandlers {
>   public MyList() {
>      // TODO: build your DOM tree here
>      setElement(ulElement);
>   }
>
>   public HandlerRegistration addClickHandler(ClickHandler handler) {
>      addDomHandler(handler, ClickEvent.getType());
>   }
>
>   // Helper method, not strictly necessary but very helpful
>   // You could either return a LIElement or the index of the item in
> the list as an int
>   public int getItemFromEvent(DomEvent<?> event) {
>      // TODO: see my previous message about how to implement it
>      // see also the code for HTMLTable.getCellForEvent
>    }
> }
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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