Revision: 4346
          http://vexi.svn.sourceforge.net/vexi/?rev=4346&view=rev
Author:   clrg
Date:     2012-02-01 02:29:12 +0000 (Wed, 01 Feb 2012)
Log Message:
-----------
Fix tooltips (Jeff you broke them!)

Modified Paths:
--------------
    trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/role/tooltipmanager.t

Modified: 
trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/role/tooltipmanager.t
===================================================================
--- trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/role/tooltipmanager.t     
2012-01-31 04:11:39 UTC (rev 4345)
+++ trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/role/tooltipmanager.t     
2012-02-01 02:29:12 UTC (rev 4346)
@@ -15,28 +15,37 @@
         var recTipReq = false;  // whether a recent tooltip request has been 
made
         var tip = false;        // 'thread in progress' flag
         
-        var model = {};
-        getModel = function() { return model; }
+        const model = {};
+        const getModel = function() { return model; }
+        const assignModel = function(removeFrom, addTo) {
+            if (addTo) {
+                addTo.tooltip ++= getModel;
+                addTo.tooltip ++= .util.common..readOnly;
+            }
+            if (removeFrom) {
+                removeFrom.tooltip --= getModel;
+                removeFrom.tooltip --= .util.common..readOnly;
+            }
+        }
+        
+        // already have access to the surface model
+        if (surface) assignModel(null, surface);
+        
+        /** gracefully handle surface changes */
         surface ++= function(v) {
-               cascade = v;
-               if (v) {
-                       surface.tooltip ++= getModel;
-                       surface.tooltip ++= .util.common..readOnly;
-               }
-               else {
-                       surface.tooltip --= getModel;
-                       surface.tooltip --= .util.common..readOnly;
-               }
+            var s = surface;
+            cascade = v;
+            if (v and v!=s) assignModel(s, v);
         }
         
         /** drop tooltip with mouse interaction */
-        var pressWrite = function(v) {
+        const pressWrite = function(v) {
             model.dropRequest(curTipReq);
             return;
         }
         
         /** popdown tooltip if it's parent widget is undisplayed */
-        var surfaceWrite = function(v) {
+        const surfaceWrite = function(v) {
             cascade = v;
             if (!trapee.surface) {
                 model.dropRequest(trapee);
@@ -44,7 +53,7 @@
         }
         
         /** popdown tooltip if it's parent widget is undisplayed */
-        var visibleWrite = function(v) {
+        const visibleWrite = function(v) {
             cascade = v;
             if (!v) {
                 model.dropRequest(trapee);
@@ -52,7 +61,7 @@
         }
         
         /** tooltip display thread function */
-        var popTooltipThread = function(v) {
+        const popTooltipThread = function(v) {
             // service while there's a valid current request
             do {
                 newTipReq = false;
@@ -68,7 +77,7 @@
             return;
         }
         
-        var startPopTooltipThread = function() {
+        const startPopTooltipThread = function() {
             if (!tip) {
                 // if thread is not already in progress, start it
                 tip = true;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to