]> gitweb.factorcode.org Git - factor.git/commitdiff
ui.gadgets.tables: show summary for mouse row or selected row.
authorJohn Benediktsson <mrjbq7@gmail.com>
Fri, 24 Oct 2014 23:32:21 +0000 (16:32 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 24 Oct 2014 23:32:21 +0000 (16:32 -0700)
basis/ui/gadgets/tables/tables.factor

index 2d24f68c9152bda31250650ea2055b867cdb033c..af7133799af1436407f9b3bfcf9f99ee8d70d61a 100644 (file)
@@ -240,11 +240,16 @@ PRIVATE>
 : show-row-summary ( table n -- )
     over nth-row
     [ swap [ renderer>> row-value ] keep show-summary ]
-    [ 2drop ]
+    [ drop hide-status ]
     if ;
 
+: update-status ( table -- )
+    dup mouse-index>>
+    [ dup selection-index>> value>> ] unless*
+    show-row-summary ;
+
 : hide-mouse-help ( table -- )
-    f >>mouse-index [ hide-status ] [ relayout-1 ] bi ;
+    f >>mouse-index [ update-status ] [ relayout-1 ] bi ;
 
 : ((select-row)) ( n table -- )
     [ selection-index>> set-model ]
@@ -292,7 +297,7 @@ M: table model-changed
         dup update-table-rows
         dup update-selection
         dup update-mouse-index
-    [ dup mouse-index>> show-row-summary ] [ relayout ] bi ;
+    [ update-status ] [ relayout ] bi ;
 
 : thin-row-rect ( table row -- rect )
     row-rect [ { 0 1 } v* ] change-dim ;