Author: max
Date: 2008-02-13 18:11:33 -0800 (Wed, 13 Feb 2008)
New Revision: 8023

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzKeyboardKernel.js
Log:
Change 20080213-maxcarlson-4 by [EMAIL PROTECTED] on 2008-02-13 17:34:25 PST
    in /Users/maxcarlson/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Avoid sending duplicate shift, ctrl, option events in inputtext

New Features:

Bugs Fixed: LPP-4267 - Onkeyup and onkeydown events fire twice in edittext and 
inputtext

Technical Reviewer: promanik
QA Reviewer: [EMAIL PROTECTED]
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details: Avoid sending shift, ctrl and option keys by preventing the keyboard 
state from getting dirtied. 
    

Tests: This runs consistently in swf and dhtml (FF osx and IE 6)
<canvas height="300">
<simplelayout/>
 <edittext id="ex" width="100">
 <handler name="onkeydown" args="kc">
 Debug.warn('keydown %w', kc);
 </handler>
 <handler name="onkeyup" args="kc">
 Debug.warn('keyup %w', kc);
 </handler>
 </edittext>

 <inputtext id="ix" width="100">
 <handler name="onkeydown" args="kc">
 Debug.warn('keydown %w', kc);
 </handler>
 <handler name="onkeyup" args="kc">
 Debug.warn('keyup %w', kc);
 </handler>
 </inputtext>

 <button>foo</button>

 <handler name="onkeydown" reference="LzKeys" args="kc">
 Debug.warn('global keydown %w', kc);
 </handler>

 <handler name="onkeyup" reference="LzKeys" args="kc">
 Debug.warn('global keyup %w', kc);
 </handler>
 </canvas>




Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzKeyboardKernel.js
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzKeyboardKernel.js   
2008-02-14 01:37:56 UTC (rev 8022)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzKeyboardKernel.js   
2008-02-14 02:11:33 UTC (rev 8023)
@@ -1,7 +1,7 @@
 /**
   * LzKeyboardKernel.js
   *
-  * @copyright Copyright 2007 Laszlo Systems, Inc.  All Rights Reserved.
+  * @copyright Copyright 2007,2008 Laszlo Systems, Inc.  All Rights Reserved.
   *            Use is subject to license terms.
   *
   * @topic Kernel
@@ -18,7 +18,9 @@
         var dirty = false;
         var k = e['keyCode'];
         var dh = LzKeyboardKernel.__downKeysHash;
-        if (k >= 0) {
+        // skip shift, ctrl, option keys to prevent duplicate sending - see 
LPP-4267
+        // really, all control characters should be skipped...
+        if (k >= 0 && k != 16 && k != 17 && k != 18) {
             // TODO: add mapping to flash character codes?
             var s = String.fromCharCode(k).toLowerCase();
             var t = e.type; 


_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins

Reply via email to