On 4 February 2011 14:03, Hilco Wijbenga <[email protected]> wrote:
> On 4 February 2011 11:21, Thomas Broyer <[email protected]> wrote:
>> GWT.getModuleBaseURL() + "my-image.png" ?
>
> Mmmh, yeah, something like that (GWT.getModuleName() +
> "/my-image.png") works. But that means I'm changing the image's url at
> runtime. I'd like to avoid that.
>
> I was hoping for something I could put in UiBinder. Can I access the
> module name as a property? E.g.
>
> <g:Image ui:field="..." url="${gwt.module-name}/my-image.png" altText="..."/>
>
> or something like that?
>
> I tried variations of {moduleName} and various fields and methods in
> the Java code but nothing works.

Okay, I finally figured it out. It turns out to be incredibly simple.

<ui:with field="gwt" type="com.google.gwt.core.client.GWT"/>
<g:Image ui:field="..." url="{gwt.getModuleName}/my-image.png" altText="..."/>

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