Author: max
Date: 2007-07-17 18:40:35 -0700 (Tue, 17 Jul 2007)
New Revision: 5692

Modified:
   openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js
   openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/swf/LzInputTextSprite.as
   openlaszlo/branches/legals/WEB-INF/lps/lfc/views/LzInputText.lzs
Log:
Change 20070717-maxcarlson-2 by [EMAIL PROTECTED] on 2007-07-17 15:56:40 PDT
    in /Users/maxcarlson/openlaszlo/legals-clean
    for http://svn.openlaszlo.org/openlaszlo/branches/legals

Summary: Fix ontext events for inputtext in swf and dhtml

New Features:

Bugs Fixed: LPP-4279 - constraints to inputtext.getText() do not fire when text 
input changes

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

Documentation:

Release Notes:

Details: swf/LzInputTextSprite.as - send events to __lzview instead of 
__lzview.owner.  Send new text for onchange event.

dhtml/LzInputTextSprite.js - Send onchange events when inputtext contents 
change.

LzInputText.lzs - ontext event uses value passed with onchange event.  Add 
getText() dependency for ontext event.

Tests: Typing in the input text causes the text below to change in swf and 
dhtml for this testcase:

<canvas debug="true" height="100%" width="100%">
<simplelayout/>
<inputtext id="intext" text="change me" />
<text text="${intext.getText()}" /> 
</canvas>





Modified: 
openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js
===================================================================
--- 
openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js    
    2007-07-17 23:16:20 UTC (rev 5691)
+++ 
openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js    
    2007-07-18 01:40:35 UTC (rev 5692)
@@ -221,7 +221,16 @@
     }    
 
     //Debug.info('__textEvent', eventname, keycode);
-    if (this.owner) this.owner.inputtextevent(eventname, keycode);
+    if (this.owner) {
+        this.owner.inputtextevent(eventname, keycode);
+        if (eventname == 'onkeydown' || eventname == 'onkeyup') {
+            var v = this.__LzInputDiv.value;
+            if (v != this.text) {
+                this.text = v;
+                this.owner.inputtextevent('onchange', v);
+            }
+        }
+    }
 }
 
 LzInputTextSprite.prototype.setEnabled = function ( val ){

Modified: 
openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/swf/LzInputTextSprite.as
===================================================================
--- openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/swf/LzInputTextSprite.as  
2007-07-17 23:16:20 UTC (rev 5691)
+++ openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/swf/LzInputTextSprite.as  
2007-07-18 01:40:35 UTC (rev 5692)
@@ -227,7 +227,7 @@
   */
 TextField.prototype.__gotFocus = function ( oldfocus ){
     // scroll text fields horizontally back to start
-    if (this.__lzview.owner) this.__lzview.owner.inputtextevent('onfocus');
+    if (this.__lzview) this.__lzview.inputtextevent('onfocus');
 }
 
 
@@ -238,7 +238,7 @@
   * @access private
   */
 TextField.prototype.__onChanged = function ( ){
-    if (this.__lzview.owner) this.__lzview.owner.inputtextevent('onchange');
+    if (this.__lzview) this.__lzview.inputtextevent('onchange', this.text);
 }
 
 /**
@@ -259,7 +259,7 @@
     //Debug.write('lostfocus', this.__lzview.hasFocus, dunno, 
LzFocus.lastfocus, this, LzFocus.getFocus(), this.__lzview);
     if (this.__lzview.hasFocus) {
         LzFocus.clearFocus();
-        if (this.__lzview.owner) this.__lzview.owner.inputtextevent('onblur');
+        if (this.__lzview) this.__lzview.inputtextevent('onblur');
     }    
 }
 

Modified: openlaszlo/branches/legals/WEB-INF/lps/lfc/views/LzInputText.lzs
===================================================================
--- openlaszlo/branches/legals/WEB-INF/lps/lfc/views/LzInputText.lzs    
2007-07-17 23:16:20 UTC (rev 5691)
+++ openlaszlo/branches/legals/WEB-INF/lps/lfc/views/LzInputText.lzs    
2007-07-18 01:40:35 UTC (rev 5692)
@@ -184,7 +184,7 @@
              this.height != this.sprite.getTextHeight() ) {
                 this.setHeight(this.sprite.getTextfieldHeight());
         }
-        this.ontext.sendEvent(this.getText());
+        this.ontext.sendEvent(value);
         return;
     }    
     this[eventname].sendEvent(value);
@@ -258,4 +258,8 @@
     return this.sprite.getText();    
 }
 
+prototype.getText.dependencies = function(who, self) {
+    return [ self, "text" ];
+}
+
 } // End of LzInputText


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

Reply via email to