     { T{ mouse-enter } [ show-mouse-help ] }
     { T{ mouse-leave } [ hide-mouse-help ] }
     { T{ motion } [ show-mouse-help ] }
-    { T{ button-down } [ click-row ] }
-    { T{ button-up } [ update-selected-value ] }
+    { T{ button-down } [ table-button-down ] }
+    { T{ button-up } [ table-button-up ] }
     { T{ gain-focus } [ t >>focused? drop ] }
     { T{ lose-focus } [ f >>focused? drop ] }
-    { T{ drag } [ click-row ] }
+    { T{ drag } [ table-button-down ] }
+    { T{ key-down f f "ENTER" } [ row-action ] }
     { T{ key-down f f "UP" } [ prev-row ] }
     { T{ key-down f f "DOWN" } [ next-row ] }
     { T{ key-down f f "HOME" } [ first-row ] }

    table new-gadget
        swap >>model
        trivial-renderer >>renderer
        f <model> >>selected-value
        { "sans-serif" plain 12 } >>font
        T{ rgba f 0.8 0.8 1.0 1.0 } >>selection-color
        black >>mouse-color
        black >>text-color ;


: (select-row) ( table row -- )
    over validate-row
    [ [ thin-row-rect ] [ drop ] 2bi scroll>rect ]
    [ >>selected-index relayout-1 ]
    2bi ;

: mouse-row ( table -- n )
    [ hand-rel second ] keep y>row ;

: table-button-down ( table -- )
    dup request-focus
    dup control-value empty? [ drop ] [
        dup [ mouse-row ] keep validate-row
        [ >>mouse-index ] [ (select-row) ] bi
    ] if ;

: row-action ( table -- )
    dup selected-row dup
    [ swap action>> call ] [ 2drop ] if ;

: table-button-up ( table -- )
    hand-click# get 2 =
    [ row-action ] [ update-selected-value ] if ;

: select-row ( table row -- )
    [ (select-row) ] [ drop update-selected-value ] 2bi ;

: prev-row ( table -- )
    dup selected-index>> [ 1- ] [ 0 ] if* select-row ;

: next-row ( table -- )
    dup selected-index>> [ 1+ ] [ 0 ] if* select-row ;

: first-row ( table -- )
    0 select-row ;
