PDA

View Full Version : Setting icon to toggle button greater than 16x16



denu
8 Nov 2011, 7:11 AM
Hello,

How can I change icon in toggle button to be greater than 16px x 16px ?

I'm setting the icon by style background:

tgBtn.setIconStyle("interactiveMode")

Icon is always clipped to 16x16. Firebug shows me that there's a table rendered inside of my ToggleButton which has something like this inside:

<img onload="this.__gwtLastUnhandledEvent=&quot;load&quot;;" src="http://127.0.0.1:8888/imlk/clear.cache.gif" style="width: 16px; height: 16px; background-image: url(http://127.0.0.1:8888/images/inter.gif); position: absolute; left: 0px; top: 8px; background-position: 0px 0px; background-repeat: no-repeat no-repeat; " border="0" role="presentation" class=" x-btn-image">
As you can see width and height are set somewhere else I don't know where in GXT.

I've tried:

tgBtn.setSize(30, 30);
which resulted in making whole toggle button bigger, but icon is stil 16x16

and I've tried

tgBtn.setScale(ButtonScale.LARGE);
but it didn't work.

I have even used

ClippedImagePrototype bla = new ClippedImagePrototype("../images/inter.gif", 0, 0, 23, 23);
setIcon(bla);
And the icon was visible all the way, but: It haven't put the image in the center of Toggle Button but next to its right edge.

I don't want to have urls inside my code. I want them in css

This is internal class of GWT as it states in its source:
/**
* Implementation of {@link AbstractImagePrototype} for a clipped image. This
* class is used internally by the image bundle generator and is not intended
* for general use. It is subject to change without warning.
*/

What can I do ?

sven
8 Nov 2011, 7:22 AM
tgBtn.setScale(ButtonScale.LARGE);



That will make your button already larger.


Than you need to do something like
tgBtn.setIcon(IconHelper.createStyle("interactiveMode", 23,23));