Author: max
Date: 2007-01-22 18:18:41 -0800 (Mon, 22 Jan 2007)
New Revision: 3481

Modified:
   openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js
   openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzMouseKernel.js
   openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzScreenKernel.js
   openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
Log:
Change 20070122-maxcarlson-u by [EMAIL PROTECTED] on 2007-01-22 15:03:51 PST
    in /Users/maxcarlson/openlaszlo/legals

Summary: Bring inputtext to the foreground on mouseover in dhtml

New Features: Before, you would have to click twice to enter text in a DHTML 
inputtext.  This change fixes that behavior.

Bugs Fixed:

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

Documentation:

Release Notes:

Details: LzSprite.js - hide shown inputtexts on mouseover

LzMouseKernel - hide shown inputtexts on mousedown or mouseup

LzInputTextSprite - track which inputtext was last shown.  Add 
__hideIfNotFocused() to hide shown inputtext for mouse events.


Tests:  All examples run as before - except inprovements.

Files:
M      WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
M      WEB-INF/lps/lfc/kernel/dhtml/LzMouseKernel.js
M      WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js

Changeset: 
http://svn.openlaszlo.org/openlaszlo/patches/20070122-maxcarlson-u.tar

Modified: 
openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js
===================================================================
--- 
openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js    
    2007-01-23 01:27:27 UTC (rev 3480)
+++ 
openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js    
    2007-01-23 02:18:41 UTC (rev 3481)
@@ -65,7 +65,7 @@
         }
         this.__LZinputclickdiv.className = 'lzclickdiv';
         this.__LZinputclickdiv.owner = this;
-        this.__LZinputclickdiv.onmousedown = function () {
+        this.__LZinputclickdiv.onmouseover = function () {
             this.owner.__show();
         }
         this.__LZclickdiv.appendChild(this.__LZinputclickdiv);
@@ -77,6 +77,8 @@
 
 LzInputTextSprite.prototype.__show = function() {
     if (this.__shown == true || this.disabled == true) return;
+    this.__hideIfNotFocused();
+    LzInputTextSprite.prototype.__lastshown = this;
     this.__shown = true;
     // bring to front of click divs
     this.__LzInputDiv = this.__LZdiv.removeChild(this.__LzInputDiv);
@@ -89,8 +91,16 @@
     //Debug.write('show');
 }
 
+LzInputTextSprite.prototype.__hideIfNotFocused = function() {
+    if (LzInputTextSprite.prototype.__lastshown == null) return;
+    if (LzInputTextSprite.prototype.__focusedSprite != 
LzInputTextSprite.prototype.__lastshown) {
+        LzInputTextSprite.prototype.__lastshown.__hide();
+    }
+}
+
 LzInputTextSprite.prototype.__hide = function() {
     if (this.__shown != true || this.disabled == true) return;
+    LzInputTextSprite.prototype.__lastshown = null;
     this.__shown = false;
     // send to __LZdiv
     if (LzSprite.prototype.quirks.fix_ie_clickable) {

Modified: 
openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzMouseKernel.js
===================================================================
--- openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzMouseKernel.js    
2007-01-23 01:27:27 UTC (rev 3480)
+++ openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzMouseKernel.js    
2007-01-23 02:18:41 UTC (rev 3481)
@@ -20,6 +20,7 @@
         if (!e) e = window.event;
         var eventname = 'on' + e.type;
         if (LzKeyboardKernel) LzKeyboardKernel.__keyboardEvent(e);
+        if (eventname != 'onmousemove' && 
LzInputTextSprite.prototype.__lastshown != null) 
LzInputTextSprite.prototype.__hideIfNotFocused();
         if (eventname == 'onmouseup' && LzMouseKernel.__lastMouseDown != null) 
{
             // call mouseup on the sprite that got the last mouse down  
             LzMouseKernel.__lastMouseDown.__globalmouseup(e);

Modified: 
openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzScreenKernel.js
===================================================================
--- openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzScreenKernel.js   
2007-01-23 01:27:27 UTC (rev 3480)
+++ openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzScreenKernel.js   
2007-01-23 02:18:41 UTC (rev 3481)
@@ -15,21 +15,40 @@
     ,height: null
     ,__resizeEvent: function() {
         // thanks quirksmode!  
http://www.quirksmode.org/viewport/compatibility.html
-        var test1 = document.body.scrollHeight;
-        var test2 = document.body.offsetHeight
+
+        if (self.innerHeight) {
+            // all except Explorer
+            var sc = window.top.document.body;
+            LzScreenKernel.width = sc.scrollWidth;
+            LzScreenKernel.height = sc.scrollHeight;
+        } else if (window.top.document.documentElement && 
window.top.document.documentElement.clientHeight) {
+            // Explorer 6 Strict Mode
+            var sc = window.top.document.documentElement;
+            LzScreenKernel.width = sc.scrollWidth;
+            LzScreenKernel.height = sc.scrollHeight;
+        } else if (window.top.document.body) {
+            // other Explorers
+            var sc = window.top.document.body;
+            LzScreenKernel.width = window.top.document.body.scrollWidth;
+            LzScreenKernel.height = window.top.document.body.clientHeight;
+        }
+
+        /*
+        var test1 = window.top.document.body.scrollHeight;
+        var test2 = window.top.document.body.offsetHeight
         if (test1 > test2) { 
             // all but Explorer Mac
-            LzScreenKernel.width = document.body.scrollWidth;
-            LzScreenKernel.height = document.body.scrollHeight;
+            LzScreenKernel.width = window.top.document.body.scrollWidth;
+            LzScreenKernel.height = window.top.document.body.scrollHeight;
         } else { 
             // Explorer Mac;
             //would also work in Explorer 6 Strict, Mozilla and Safari
-            LzScreenKernel.width = document.body.offsetWidth;
-            LzScreenKernel.height = document.body.offsetHeight;
-        }
+            LzScreenKernel.width = window.top.document.body.offsetWidth;
+            LzScreenKernel.height = window.top.document.body.offsetHeight;
+        }*/
 
         if (LzScreenKernel.__callback) 
LzScreenKernel.__scope[LzScreenKernel.__callback]({width: LzScreenKernel.width, 
height: LzScreenKernel.height});
-        //Debug.write('LzScreenKernel event', {width: LzScreenKernel.width, 
height: LzScreenKernel.height});
+        Debug.write('LzScreenKernel event', {width: LzScreenKernel.width, 
height: LzScreenKernel.height});
     }
     ,__init: function() {
         window.top.onresize = LzScreenKernel.__resizeEvent;

Modified: openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
===================================================================
--- openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js 
2007-01-23 01:27:27 UTC (rev 3480)
+++ openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js 
2007-01-23 02:18:41 UTC (rev 3481)
@@ -593,6 +593,7 @@
     if (LzKeyboardKernel) LzKeyboardKernel.__keyboardEvent(e);
     var skipevent = false;
     var eventname = 'on' + e.type;
+    if (eventname == 'onmouseover' && LzInputTextSprite.prototype.__lastshown 
!= null) LzInputTextSprite.prototype.__hideIfNotFocused();
     if (eventname == 'onmousedown') {
         // cancel mousedown event bubbling...
         e.cancelBubble = true;


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

Reply via email to