I would like to know if it is somehow possible to use widgets in a ToggleButton, because I have an image on the downFace of a ToggleButton and want to use the Image widget, so that I can define a resource property.
Code looks like this (or should look like this, doesn't work of course):
<g:ToggleButton addStyleNames="{res.css.button} {res.css.active} {style.inventory-button}">
<g:upFace>upFace Text</g:upFace>
<g:downFace>downFace Text <g:Image resource="{res.wantedImage}" addStyleNames="{res.css.load}"></g:Image></g:downFace>
</g:ToggleButton>
ToggleButton
's g:downFace
takes an ImageResource
as an image=
attribute:
– Source: http://www.gwtproject.org/javadoc/latest/com/google/gwt/user/client/ui/CustomButton.html
But you cannot use both an image and text that way.
AFAICT, you can however use an image and text through HTML (but without widget):
<g:downFace>downFace Text <img src="{res.wantedImage.getSafeUri}" /></g:downFace>
or through a @sprite
in a CssResource
:
<g:downFace>downFace Text <span class="{res.css.wantedImageAsSprite}"></span></g:downFace>