<p>Hey guys,</p>
<p>I saw a recent post about key handlers, and I<br>have 2 questions about this subject.</p>
<p>1st) The keys are not captured in initial stage, <br>when the page is loaded at first time. I suppose <br>it happens when the viewport is not focused. This <br>is a bug? I think it's useful for the user if the <br>keys are "usable" even if the view port is focused,
<br>something like a "global" hotkey.</p>
<p>2nd) I'm trying to develop a function to improove <br>the navigability. Based on Photoshop and CorelDraw, <br>the idea is allow user select different tools<br>by pressing CTRL, ALT, SHIFT, and combinations<br>of these keys. For example, considering the pan
<br>the standard tool, the application opens with<br>pan tool selected, and if the user press AND HOLD<br>(keydown event) the SHIFT key, the tool (and mouse <br>pointer) change to the query tool. When the user<br>release the key (keyup event), the tool back to
<br>the pan tool (and mouse pointer too). </p>
<p>The problem is that kaTool.prototype.onkeypress <br>handler is not called when you press CTRL, ALT or <br>SHIFT keys.</p>
<p>I'm working overriding the onkeydown and onkeyup<br>of document object, so the keys are capture even<br>if the viewport isn't focused. I'm in the right<br>way? There is a better solution?</p>
<p>I call this function in the onload event of<br>the BODY tag of index.html:<br>function loadEventHandlers() {<br> document.onkeydown = event_OnKeyDown;<br> document.onkeyup = event_OnKeyUp;<br>}<br> </p>
<p>And the event handlers are something like this:<br>event_OnKeyDown = function(e) {<br> e = (e)? e : ( (event)? event : null );<br> if (e) {<br> // Process the key here<br> }<br>}</p>
<div>regards,</div>
<div> </div>
<div><font color="#888888">===========================================<br> Pedro Simonetti Garcia<br>===========================================<br> Software Engineering <br> Hiparc Geoteclogogia (</font><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.hiparc.com.br/" target="_blank">
<font color="#888888">www.hiparc.com.br</font></a><font color="#888888">)<br>=========================================== </font><span></span><br> </div>