Tk Library Source Code

Artifact [32a77eb160]
Login

Artifact 32a77eb160492765f38234e5ec24e466ef323ac4:

Attachment "tooltip-fade.patch" to ticket [1641071fff] added by tallniel 2007-01-22 05:18:32.
Index: tooltip.tcl
===================================================================
RCS file: /cvsroot/tcllib/tklib/modules/tooltip/tooltip.tcl,v
retrieving revision 1.6
diff -u -r1.6 tooltip.tcl
--- tooltip.tcl	2 Aug 2006 18:59:51 -0000	1.6
+++ tooltip.tcl	21 Jan 2007 22:06:29 -0000
@@ -304,7 +304,18 @@
     variable G
 
     after cancel $G(AFTERID)
-    catch {wm withdraw $G(TOPLEVEL)}
+    #catch {wm withdraw $G(TOPLEVEL)}
+    fade $G(TOPLEVEL)
+}
+
+proc ::tooltip::fade {win {step 0.15}} {
+    if {[catch {wm attributes $win -alpha} alpha] || $alpha <= 0.0} {
+        catch { wm withdraw $win }
+        catch { wm attributes $win -alpha 1.0 }
+    } else {
+        wm attributes $win -alpha [expr {$alpha-$step}]
+        after 50 [namespace code [list fade $win $step]]
+    }
 }
 
 proc ::tooltip::wname {{w {}}} {