SOLVED! Ya, nvm, I solved it. I just needed to use negative values on the int values returned by ImageResource.getLeft() and ImageResource.getTop() and add "px" to them for the string.
cheers! On Jun 17, 4:45 pm, Sky <myonceinalifet...@gmail.com> wrote: > public static void setBGImage(Widget w, ImageResource img, RepeatStyle > repeatStyle){ > String background = > "url(\"" + img.getURL() + "\") " + > img.getLeft() + " " + > img.getTop() > ; > > if (repeatStyle == RepeatStyle.None > || repeatStyle == RepeatStyle.Horizontal) { > w.setHeight(img.getHeight() + "px"); > } > > if (repeatStyle == RepeatStyle.None || repeatStyle == > RepeatStyle.Vertical) { > w.setWidth(img.getWidth() + "px"); > } > > if(repeatStyle != RepeatStyle.None){ > w.getElement().getStyle().setProperty("overflow", "hidden"); > } > > String repeatText; > switch (repeatStyle) { > case None: > repeatText = " no-repeat"; > break; > case Horizontal: > repeatText = " repeat-x"; > break; > case Vertical: > repeatText = " repeat-y"; > break; > case Both: > repeatText = " repeat"; > break; > default: > throw new RuntimeException("Unknown repeatStyle " + repeatStyle); > } > background += repeatText; > > w.getElement().getStyle().setProperty("background", background); > > } > > On Jun 17, 4:43 pm, Sky <myonceinalifet...@gmail.com> wrote: > > > > > Hi, I've got some custom code that takes a Widget, an ImageResource > > and a RepeatStyle and puts that image as the background for that > > widget. It works perfectly in IE8, FF, and Chrome, but it does not > > work in IE7. The data appears to get messed up in the > > Style.setProperty() method for the attribute "background". > > > In the latest browsers it is using Data URLs for the css background, > > but in IE7 it is using normal URLs (ImageResource.getURL() abstracts > > this process from me). > > > An example of the problem is that ImageResource.getLeft() returns the > > int value 302 and my code builds the string "url("abcd.cache.png") 302 > > 20 no-repeat" but when I use IE's DOM inspector the string is > > "url(abcd.cache.png") #302 no-repeat 20px". > > > So the Style.setProperty() is changing my values... it added '#', "px" > > and moved "no-repeat" in front of the "20px"... how and why and how > > can I fix this? > > > You can see IE7 mess up the On/Off buttons on this > > page:http://subtabs.skystrider.com/#stpID1tab2as1pnOptions/General%20Options > > > See below for my code: -- 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-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.