Hi All, here is some code I am sharing as I think it might be useful to other beginners.
This snippet shows : 1) my attempt at following Jon's hint regarding removing the right-click action on a table row. 2) how to change the data that is displayed. Look in row-hook, the main word is set-control-value. To run the code, you can copy and paste in the factor window, and then type sgui2 at the repl. Is there a more appropriate location to share these snippets ? Cheers, Manuel ! --------------------------------------- USING: accessors colors.constants kernel math math.parser math.ranges models sequences ui ui.commands ui.gadgets ui.gadgets.scrollers ui.gadgets.tables ui.gestures ; IN: sgui2 TUPLE: no-rc-table < table ; ! this prevents the show-table-menu action on right-click : "no right-click table" no-rc-table "row" f { { T{ button-down f f 3 } drop } } define-command-map SINGLETON: seq-renderer M: seq-renderer filled-column drop 0 ; M: seq-renderer column-titles drop { "Value" } ; M: seq-renderer row-columns drop number>string { } 1sequence ; M: seq-renderer row-color 2drop "blue" named-color ; M: seq-renderer row-value drop ; : init-range ( -- range ) 0 19 [a,b] ; : new-range ( value -- range ) dup 19 + [a,b] ; : row-hook ( gadget -- ) dup selected-row [ new-range ] [ drop init-range ] if swap set-control-value ; : <sgui2> ( -- table ) init-range <model> seq-renderer no-rc-table new-table 8 >>gap COLOR: dark-gray >>column-line-color { 200 400 } >>pref-dim [ row-hook ] >>hook ; MAIN-WINDOW: sgui2 { { title "Simple GUI 2" } } <sgui2> <scroller> >>gadgets ; ! --------------------------------------- ------------------------------------------------------------------------------ DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access Free app hosting. Or install the open source package on any LAMP server. Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native! http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk _______________________________________________ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk