Skip to content

Instantly share code, notes, and snippets.

@dmackerman
Created December 28, 2011 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmackerman/1528095 to your computer and use it in GitHub Desktop.
Save dmackerman/1528095 to your computer and use it in GitHub Desktop.
// *NOTE* : This is currently certified for Ext JS 3.0 - 3.3.1
var win = new Ext.Window({
height : 200,
width : 300,
layout : 'fit',
items : {
xtype : "textarea",
value : 'Click here, then click a button!'
},
buttons : [
{
text : 'Steals focus!'
},
{
text : 'Does not steal focus!',
// @override
onMouseDown : function(e){
if(!this.disabled && e.button === 0){
e.stopEvent(); // injected line here
this.getClickEl(e).addClass('x-btn-click');
this.doc.on('mouseup', this.onMouseUp, this);
}
},
// @override
onMouseUp : function(e){
if(e.button === 0){
e.stopEvent(); // injected line here
this.getClickEl(e, true).removeClass('x-btn-click');
this.doc.un('mouseup', this.onMouseUp, this);
}
}
}
]
});
win.show();
win.items.items[0].el.focus()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment