PDA

View Full Version : Icon in button



kiprud
28 Jun 2010, 1:08 PM
Hi,
i've tried to put an image in a button with this code

Ext.setup({
icon: 'icon.png',
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
glossOnIcon: false,
onReady: function() {
var tabpanel = new Ext.TabPanel({
tabBar: {
dock: 'bottom',
layout: {pack: 'center'}
},
fullscreen: true,
ui: 'dark',
animation: {
type: 'cube',
cover: true
},
defaults: {scroll: 'vertical'},
items: [{
title: 'About',
html: '<h1>Bottom Tabs</h1>',
iconCls: 'info',
cls: 'card1'
}, {
title: 'User',
iconCls: 'user',
items:[
{
xtype: 'button',
//ui: 'action_round',
text: 'hehe',
cls:'x-btn-text-icon',
icon: 'essai.png'
}
]
}]
});
}
});

but image is never show, why ?


this is my head index.html declaration :
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Tabs 2</title>
<link rel="stylesheet" href="../../resources/css/ext-touch.css" type="text/css">
<script type="text/javascript" src="../../ext-touch-debug.js"></script>
<script type="text/javascript" src="index.js"></script>

<style type="text/css" media="screen">
body {
background-color: #333;
}

</style>

Can someone help me please ? Give me a sample code which show icon, image in button, please ...

Best regards.

GermanGuy
30 Jun 2010, 5:53 AM
Hi,
..same here, was using about the same code as kiprud, is there anything wrong about the code maybe ?
Any directions would be very much appreciated,
thanks so much,
Frank

Aldri
7 Jul 2010, 7:37 AM
Same problem here, i can't figure out how to show my image on the button, is it bugged ?
I've tried with the options icon and iconCls without success :(

Aldri
7 Jul 2010, 11:44 PM
Ok i found a way to add an icon to my button:


var button_test = new Ext.Button({
width: 40,
height: 40
});
button_test.addClass('mybuttonclass');
and in my css file :


.mybuttonclass{
background-image: url('../images/mybuttonimage.gif');
}
obviously it should work with iconCls but it doesn't... at least this way it does !

kiprud
9 Jul 2010, 12:36 PM
thansk a lot. Good job !