1 var tabs = new Ext.TabPanel({
2 renderTo: 'tabs1',
3 width:450,
4 activeTab: 0,
5 frame:true,
6 defaults:{autoHeight: true},
7 items:[
8 {contentEl:'script', title: 'Short Text'},
9 {contentEl:'markup', title: 'Long Text'}
10 ],
11 initEvents : function(){
12 Ext.TabPanel.superclass.initEvents.call(this);
13 this.on('add', this.onAdd, this, {target: this});
14 this.on('remove', this.onRemove, this, {target: this});
15 this.mon(this.strip, 'mousedown', this.onStripMouseDown, this);
16 this.mon(this.strip, 'contextmenu', this.onStripContextMenu, this);
17 if(this.enableTabScroll){
18 this.mon(this.strip, 'mousewheel', this.onWheel, this);
19 }
20 //ADD:monitor title dbclick
21 this.mon(this.strip,'dblclick',this.onTitleDbClick,this);
22 },
23 //ADD: handler
24 onTitleDbClick:function(e,target,o){
25 var t = this.findTargets(e);
26 if (t.item.fireEvent('beforeclose', t.item) !== false) {
27 t.item.fireEvent('close', t.item);
28 this.remove(t.item);
29 }
30 }
31 });