That is correct!

Label will wrap either span or div elements. if you want to wrap other  
elements there may already be other widgets that work with them.

The only thing to be aware of is, if at sometime in the lifespan of  
your page you remove that element, or dispose of the widget, be sure  
to call RootPanel.detachNow(myLabel); to break the circular reference  
between GWT and DOM for that widget. This prevents a memory leak.

-jason

On Jan 11, 2009, at 12:31 AM, Fred Janon wrote:

> Aaaaaahhhh, I knew there was something easier than subclassing...
>
> Here is it:
>
> in the Label class:
>
> static Label wrap(Element element)
>           Creates a Label widget that wraps an existing <div> or  
> <span> element.
>
> Example:
>
> somewhere in my HTML file:
>
>     <span id='colorpicker3'>span colorpicker3</span>
>
> and in the GWT java code:
>
>          Label spanLabel =  
> Label.wrap(Document.get().getElementById(("colorpicker3")));
>          spanLabel.addClickListener(new ClickListener()
>              {
>              public void  
> onClick(com.google.gwt.user.client.ui.Widget sender)
>                  {
>                  GWT.log("Label spanLabel onClick", null);
>                  };
>              } );
>
> And I also found the "InlineLabel" based on a SPAN element.
>
> Fred
>
> On Sun, Jan 11, 2009 at 12:12, Fred Janon <[email protected]> wrote:
> Ian,
>
> Nothing was wrong in your suggestion, I just cannot modify the DOM  
> structure by adding an element for CSS reasons. My implementation  
> needs to be as unobtrusive as possible.
>
> Thanks
>
> Fred
>
>
> On Sun, Jan 11, 2009 at 11:01, Ian Bambury <[email protected]>  
> wrote:
> What was wrong with the suggestion made in response to your previous  
> posting?
>
>
> Ian
>
> http://examples.roughian.com
>
>
> 2009/1/11 Fred Janon <[email protected]>
>
> Hi,
>
> I need to add some functionality to an existing web page with a SPAN  
> element and add a click listener to it. The SPAN element is not  
> created with GWT. Is there a way to do that?
>
> Thanks
>
> Fred
>
>
>
>
>
>
>
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to