Aaaaaahhhh, I knew there was something easier than subclassing...
Here is it:
in the Label class:
static
Label<file:///C:/GWT/doc/javadoc/com/google/gwt/user/client/ui/Label.html>
*wrap<file:///C:/GWT/doc/javadoc/com/google/gwt/user/client/ui/Label.html#wrap%28com.google.gwt.dom.client.Element%29>
*(Element<file:///C:/GWT/doc/javadoc/com/google/gwt/dom/client/Element.html>
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
-~----------~----~----~----~------~----~------~--~---