PDA

View Full Version : me.application.addListener and detecting Ctrl+click with ctrlKey - Please help



glafrance
6 Feb 2013, 9:32 AM
I have an image control defined to fire an event as so:


xtype: 'image',
id: 'brandingImg',
listeners: {
//The click event and handler
afterrender: function (el) {
el.getEl().on('click', function () {
OMPortal.app.fireEvent('logoClickEvent');
}, el);
}
}


I then set up a listener in a controlled, and an event handler, but e.ctrlKey is undefined. Please help.


init: function() {
var me = this;

me.application.addListener({
'logoClickEvent': me.onLogoClick
});
}

onLogoClick: function (e, t, eOpts) {
if (e.ctrlKey) {
alert('it works');
}
}

glafrance
6 Feb 2013, 9:41 AM
Figured it out:

afterrender: function (el) {
el.getEl().on('click', function (e, t, eOpts) {
OMPortal.app.fireEvent('logoClickEvent', e, t, eOpts);
}, el);
}