! Copyright (C) 2009 Your name. ! See http://factorcode.org/license.txt for BSD license. USING: arrays kernel namespaces ui ui.gadgets.buttons ui.gadgets.grids ui.tools.listener ; IN: sokoban SYMBOL: canvas DEFER: button-42 : button-2 ( -- ) canvas get 1 0 grid-remove "2" [ drop [ button-42 ] call-listener ] 1 0 grid-add drop ; : button-42 ( -- ) canvas get 1 0 grid-remove "42" [ drop [ button-2 ] call-listener ] 1 0 grid-add drop ; : ( -- gadget ) ! Working one, but calling listener, focus on IDE: "1" [ ] "2" [ drop [ button-42 ] call-listener ] 2array ! Not working, does nothing: ! "1" [ ] "2" [ drop [ button-42 ] call ] 2array ! Throws "POSTPONE" Error message: ! "1" [ ] "2" [ drop button-42 ] 2array "3" [ ] "4" [ ] 2array 2array ; ! run ui : start-sokoban ( -- ) [ dup canvas set "Sokoban" open-window ] with-ui ; MAIN: start-sokoban