PDA

View Full Version : Accessing Toolbar Buttons



franzisk
2 Jul 2007, 11:57 AM
How can I access toolbar buttons and, let's say, enable/disable the buttons?


var tbMessage = new Ext.Toolbar('tb-message');

tbMessage.addButton({
text:'Reply',
id:'btn-message-reply',
cls: 'x-btn-text-icon bmenu',
icon:'../css/images/email_edit.png',
handler: function(){ alert('reply') },
minWidth:90
});

tbMessage.addButton({
text:'Delete Profile',
id:'btn-delete-profile',
cls: 'x-btn-text-icon bmenu',
icon:'../css/images/delete.gif',
handler: function(){ alert('delete') },
minWidth:90
});

tryanDLS
2 Jul 2007, 12:21 PM
This has been covered numerous times. Either save refs to the buttons as you add them, or pull from the items property by id (it's a MixedCollection object).

franzisk
2 Jul 2007, 12:56 PM
Thanks, I got the buttons this way:


btnReply = tbMessage.items.items[0];
btnDeleteProfile = tbMessage.items.items[1];