extjs 快捷键

 

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 

      }]); 

    } 

  }

})

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值