2150 |
mathias |
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
|
|
2 |
"http://www.w3.org/TR/html4/strict.dtd">
|
|
|
3 |
<html>
|
|
|
4 |
<head>
|
|
|
5 |
<title>Typematic Test</title>
|
|
|
6 |
<style type="text/css">
|
|
|
7 |
@import "../../../dojo/resources/dojo.css";
|
|
|
8 |
@import "../../themes/tundra/tundra.css";
|
|
|
9 |
@import "../css/dijitTests.css";
|
|
|
10 |
</style>
|
|
|
11 |
|
|
|
12 |
<script type="text/javascript" src="../../../dojo/dojo.js"
|
|
|
13 |
djConfig="isDebug: true, debugAtAllCosts: true"></script>
|
|
|
14 |
<script type="text/javascript">
|
|
|
15 |
dojo.require("dijit._base.typematic");
|
|
|
16 |
|
|
|
17 |
var lastCount = 0;
|
|
|
18 |
function typematicCallBack(count, node, evt){
|
|
|
19 |
var inputNode = dojo.byId('typematicInput');
|
|
|
20 |
if (node == inputNode){
|
|
|
21 |
key = "a";
|
|
|
22 |
}else{
|
|
|
23 |
key = "b";
|
|
|
24 |
}
|
|
|
25 |
if(-1 == count){
|
|
|
26 |
console.debug((lastCount+1) + ' ' + key + ' events');
|
|
|
27 |
}else{
|
|
|
28 |
lastCount = count;
|
|
|
29 |
inputNode.value += key;
|
|
|
30 |
}
|
|
|
31 |
inputNode.focus();
|
|
|
32 |
}
|
|
|
33 |
dojo.addOnLoad(function(){
|
|
|
34 |
var keyNode = dojo.byId('typematicInput');
|
|
|
35 |
var mouseNode = dojo.byId('typematicButton');
|
|
|
36 |
dijit.typematic.addKeyListener(keyNode,
|
|
|
37 |
{
|
|
|
38 |
keyCode:dojo.keys.F10,
|
|
|
39 |
ctrlKey:true
|
|
|
40 |
},
|
|
|
41 |
this, typematicCallBack, 200, 200);
|
|
|
42 |
dijit.typematic.addMouseListener(mouseNode,
|
|
|
43 |
this, typematicCallBack, 0.9, 200);
|
|
|
44 |
keyNode.focus(); // make it easier to type
|
|
|
45 |
});
|
|
|
46 |
</script>
|
|
|
47 |
</head>
|
|
|
48 |
<body class="tundra">
|
|
|
49 |
|
|
|
50 |
<h2>Dijit typematic tests</h2>
|
|
|
51 |
Press and hold the <b>ctrl+F10</b> keys to see a's typed (constant rate) in the input field,<br>
|
|
|
52 |
or left-mouse click the button and hold down to see b's typed (increasing rate) in the input field.<br>
|
|
|
53 |
<input id="typematicInput" size="500"><button id="typematicButton">to B or not to B</button>
|
|
|
54 |
|
|
|
55 |
</body>
|
|
|
56 |
</html>
|