PDA

View Full Version : KeyMap: catching and stoping Ctrl+Tab



Daniil
13 Mar 2011, 2:32 PM
Hi ExtJS team and others,

Does anyone have experience how to catch and stop Ctrl+Tab keys combination?

I tried KewMap with ctrlKey, key '9' and stopEvent, with no success. It even doesn't catch this keys combination.

I tried the following code:


var processKey = function (e) {
if (Ext.isIE) {
e = event;
}

Ext.get("log").insertHtml("afterEnd", "<p>" + e.ctrlKey + ": " + e.keyCode);
if (e.ctrlKey && e.keyCode == 9) {
Ext.Msg.alert("Ctrl+Tab", "Hello from Ctrl+Tab");
if (!Ext.isIE) {
e.preventDefault();
return;
}

e.keyCode = 0;
return false;
}
}

var onReady = function () {
if (document.addEventListener) {
document.addEventListener('keydown', processKey, false);
} else if (document.attachEvent) {
document.attachEvent('onkeydown', processKey);
} else {
document.onkeydown = processKey;
};
}

It seems it catches this keys combination fine under FF 3.6.15 but doesn't stop. And it even doesn't catch that under IE8. By the way, works fine under IE6, IE7.

Any thoughts would be really appreciated.

steffenk
13 Mar 2011, 3:23 PM
What do you try? ctrl + tab is catched by the OS for switch to bext windows.

Daniil
13 Mar 2011, 3:32 PM
I think you mean Alt+Tab, but I told about Ctrl+Tab - it switches browser's tabs. I don't think OS handles Ctrl+Tab, at least, Windows.

steffenk
13 Mar 2011, 3:40 PM
both are reserved at least on my windows
ctrl + tab: switch direct to next window
alt + tab: show all windows as thumbs and allow tabbing to the window you want to switch to

Daniil
13 Mar 2011, 3:45 PM
I tested under Windows 7 Home Premium. Please clarify what version do you use?

steffenk
13 Mar 2011, 4:20 PM
same.
ok - seems to be FF that catchs the event.
Anyway with such key combination you run in trouble.

Daniil
14 Mar 2011, 7:18 AM
I have the same under IE8 and Chrome 9. Just curious/need how to catch. I'm pretty sure it's possible.

Daniil
22 Mar 2011, 2:04 AM
Yes, you are right, I run in trouble with such combination.

Really, I decided to give it up.