Hmm, it seems that I posted a reply to an imaginary question that I 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 <[email protected]> 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<[email protected]> 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 [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.
