PDA

View Full Version : How to make a toolbar button stretch to its icon size?



fzammetti
13 Jul 2010, 9:27 AM
Hi folks... gotta think this is simple, but it's beating me... I have a toolbar with a button like so:

{ xtype : "button", cls : "x-btn-icon",
id : "myButton",
tooltip : "Click me",
icon : applicationStaticImagesPath +
"/img/toolbarIcon.gif",
handler : function(inButton) {
}
}

Nothing fancy. Here's the problem... the button is only about 20 pixels or side wide, so the icon is cut off because the icon image is 75 pixels wide. I need the button to stretch to the width of the icon. I tried specifying width, but that just makes the button the width I want, the icon is still cut to about 20 pixels wide in the middle of the button. I've tried doing this with iconCls instead but haven't had any luck. Can anyone point me in the right direction?

Thanks,
Frank

fzammetti
13 Jul 2010, 12:22 PM
I figured this out. It wound up working with iconCls, but I had to add !important to the background styles and also set a width attribute on it. Once I did that it's working exactly as I want it to. Thanks all!