thought I had posted to GWT. In case anyone is still wondering, that
question was: how to add a single image to a MenuBar?
To answer the original question, I went with getting the clientWidth
and clientHeight from the DOM. These values still include padding,
but that is actually good for what I wanted to do.
Regards,
z.
On Dec 26, 2:15 am, Zakaluka <zakal...@gmail.com> wrote:
> I've been able to come up with a tentative solution. This is on GWT
> 2.4. I was looking to put in an image because I want to insert a
> small logo in the menu - that way people on small screens don't have
> to deal with a large header.
>
> Using only UiBinder (without any Java code) to do this doesn't work.
> Even though the HTML code I used was identical to what I put into the
> Java file's constructor, it didn't work when that code was transferred
> to UiBinder (the image wouldn't show up - inspecting the HTML/JS
> showed that it wasn't setting the Image URI properly). Using a "<"
> character in a MenuItem's HTML property in UiBinder is not allowed and
> putting a <img> tag into the MenuItem didn't work right. I tried
> many, many variations on this theme, including creating a
> MenuBar.Resources file, but what I ended up implementing was the
> simplest, easiest solution I was able to come up with.
>
> In the UiBinder file, I put in:
> <g:MenuItem enabled="false" ui:field="logo"
> stylePrimaryName="{abcb.logoCss.logosmall}"/>
>
> In the Java file's constructor:
> logo.setHTML("<img src='"
> +
> AppBaseClientBundle.INSTANCE.logo_small().getSafeUri().asString()
> + "' />");
>
> Hope this helps someone trying to accomplish something similar.
>
> - z.
>
> On Dec 23, 12:53 pm,Zakaluka<zakal...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hello,
>
> > I know this question has been asked before, but the replies are all
> > from 2006/2007, so I wanted to see if things have changed.
>
> > Is there any way to get a Widget's width or height minus decorations?
> > getOffsetWidth() and getOffsetHeight() only return their respective
> > totals (including margin, padding and border).
>
> > Is there some DOM attribute that might be holding this information?
>
> > Thank you,
>
> > z.
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment