Author: max
Date: 2007-08-17 15:29:20 -0700 (Fri, 17 Aug 2007)
New Revision: 6132

Modified:
   
openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/kernel/swf/LzInputTextSprite.as
   openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/views/LzInputText.lzs
Log:
Change 20070817-maxcarlson-I by [EMAIL PROTECTED] on 2007-08-17 12:08:41 PDT
    in /Users/maxcarlson/openlaszlo/wafflecone
    for http://svn.openlaszlo.org/openlaszlo/branches/wafflecone

Summary: Fix duplicate onfocus and onblur events

New Features:

Bugs Fixed: LPP-3907 - edittext and inputtext may fire onfocus resp. onblur 
twice

Technical Reviewer: promanik
QA Reviewer: jcrowley
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details: LzInputTextSprite.as - Fix test for current focus in 
__handlelostFocus().  

LzInputTextSprite.lzs - Track current focus/blur state to avoid sending 
duplicate events.
    

Tests: Testcase from LPP-3907 passes in swf and dhtml.



Modified: 
openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/kernel/swf/LzInputTextSprite.as
===================================================================
--- 
openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/kernel/swf/LzInputTextSprite.as  
    2007-08-17 22:22:51 UTC (rev 6131)
+++ 
openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/kernel/swf/LzInputTextSprite.as  
    2007-08-17 22:29:20 UTC (rev 6132)
@@ -256,8 +256,8 @@
   * @access private
   */
 TextField.prototype.__handlelostFocus = function ( ){
-    //Debug.write('lostfocus', this.__lzview.hasFocus, dunno, 
LzFocus.lastfocus, this, LzFocus.getFocus(), this.__lzview);
-    if (this.__lzview.hasFocus) {
+    //Debug.write('lostfocus', this.__lzview.hasFocus, LzFocus.lastfocus, 
this, LzFocus.getFocus(), this.__lzview, this.__lzview.inputtextevent);
+    if (this.__lzview == LzFocus.getFocus()) {
         LzFocus.clearFocus();
         if (this.__lzview) this.__lzview.inputtextevent('onblur');
     }    

Modified: openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/views/LzInputText.lzs
===================================================================
--- openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/views/LzInputText.lzs        
2007-08-17 22:22:51 UTC (rev 6131)
+++ openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/views/LzInputText.lzs        
2007-08-17 22:29:20 UTC (rev 6132)
@@ -162,20 +162,27 @@
 
 /** @access private */
 function _gotFocusEvent(){
+    this._focused = true;
     this.sprite.gotFocus();
 }
 
 /** @access private */
 function _gotBlurEvent(){
+    this._focused = false;
     this.sprite.gotBlur();
 }
 
 // Receive input text events from sprite
 function inputtextevent (eventname, value){
+    //Debug.warn('inputtextevent', eventname, value);
+    if (eventname == 'onfocus' && this._focused) return;
+    if (eventname == 'onblur' && ! this._focused) return;
     if (eventname == 'onfocus' || eventname == 'onmousedown') {
+        this._focused = true;
         if (LzFocus.getFocus() != this) {
             var tabdown = LzKeys.isKeyDown('tab');
             LzFocus.setFocus(this, tabdown);
+            return;
         }
     } else if (eventname == 'onchange') {
         //multiline resizable fields adjust their height
@@ -186,7 +193,9 @@
         }
         if (this.ontext.ready) this.ontext.sendEvent(value);
         return;
-    }    
+    } else if (eventname == 'onblur') {
+        this._focused = false;
+    }
     if (this[eventname].ready) this[eventname].sendEvent(value);
 }
 


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

Reply via email to