PDA

View Full Version : [CLOSED] KeyMap and Control Key only



matt
Dec 22, 2014, 6:56 PM
Hi,

Is there a way to detect that only Control key is pressed (without any other key) ?

I would like to change some behavior in my app if user hold Control key and click something.

Thank you,

Daniil
Dec 23, 2014, 9:08 AM
Hi @matt,

Let's start with this example.

Example

<%@ Page Language="C#" %>

<!DOCTYPE html>

<html>
<head runat="server">
<title>Ext.NET v2 Example</title>

<script>
Ext.onReady(function() {
Ext.getDoc().on("mousedown", function(e) {
if (e.ctrlKey) {
console.log("Mouse click with Ctrl");
}
});
});
</script>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
</form>
</body>
</html>

This might help you to deal with a case when a user presses more than one key.
http://stackoverflow.com/questions/13640061/get-a-list-of-all-currently-pressed-keys-in-javascript