         20 >>size
         dup '[ _ [ grid>> next-step ] [ relayout-1 ] bi ]
         f 1/5 seconds <timer> >>timer ;
-
-M: grid-gadget graft*
-    [ timer>> start-timer ] [ call-next-method ] bi ;
 
 M: grid-gadget ungraft*
     [ timer>> stop-timer ] [ call-next-method ] bi ;

M: grid-gadget draw-gadget*
    [ update-grid ] [ draw-cells ] [ draw-lines ] tri ;

:: on-click ( gadget -- )
    gadget size>> :> size
    gadget grid>> grid-dim :> ( rows cols )
    gadget hand-rel first2 [ size /i ] bi@ :> ( i j )
    i 0 cols 1 - between?
    j 0 rows 1 - between? and [
        i j gadget grid>> nth [ not ] change-nth
    ] when gadget relayout-1 ;

:: on-drag ( gadget -- )

    gadget hand-rel first2 [ size /i ] bi@ :> ( i j )
    i 0 cols 1 - between?
    j 0 rows 1 - between? and [
        last-click get i j gadget grid>> nth set-nth
    ] when gadget relayout-1 ;

: on-scroll ( gadget -- )
