var window = new Ext.Window({
id : "window"+that.receiverId,
title : '您正在与'+that.receiverName+'聊天',
iconCls:'menu-appuser',
width : 440,
height : 420,
layout:'fit',
items : [panel],
modal:false,
buttonAlign : 'center',
buttons : [{
text : '发送',
iconCls:'btn-ok',
scope:'true',
handler : function(){
var message = that.sendTextArea;
if(message.getValue()!=''){
var content = that.contentTextArea.getValue()+"\n"+that.senderName+" "+new Date().format('Y-m-d H:m:s')+"\n "+message.getValue();
that.contentTextArea.setValue(content);
ChatService.sendMessage(that.senderId,that.receiverId,encodeURI(message.getValue(),"utf-8"));
message.setValue("");
}
}
}, {
text : '关闭',
iconCls:'btn-cancel',
handler : function() {
window.close();
}
}],
keys:[{
key : 'c',
alt : true,
fn : function(){window.close();},
scope : this
}]
});
红色部分 alt+c关闭 window窗口
var map = new Ext.KeyMap(对象, [{
key: Ext.EventObject.ENTER,
fn: handleKey,
shift: true,
ctrl: (true/false),
alt: (true/false),(这三个是表示联合快捷键)
scope: this
},{
key:Ext.EventObject.ESC,
fn:function{close();},
scope:this
}]
);
绑定一个新的快捷键
map.addBinding({
key: 'abc',
fn: handleKey,
scope: this
});
that.sendTextArea = new Ext.form.TextArea({
region : 'center',
width : 270,
xtype : 'textarea',
enableKeyEvents : true,
listeners: {
'render': function (input) {
new Ext.KeyMap(input.getEl(), [{
key: 13,
ctrl: true,
fn: function() {alert("f");},
scope: this
}]);
}
}
})