Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Question: [ searching for answer on GUI speed ]

From: greggirwin:mindspring at: 12-Mar-2002 23:02

Hi Ryan, et al << Check out this script I just made: >> Very cool! In return, here's a very quick hack that generates draw commands, just to see if this would work in a simple fashion. Obviously you could make it much smarter by not regenerating the whole set of drawing commands from scratch each time, and just poke new data into the block instead, but this works for a simple test. --Gregg cell-size: 120x21 map-slider-to-value: func [ "Converts a slider value between 0 and 1 to a value within a range." value [number!] "A value between 0 and 1." min-val [number!] "The minimum range value (if value = 0)." max-val [number!] "The maximum range value (if value = 1)." ][ max-val - min-val * value + min-val ] display-data: does [ v-base-val: map-slider-to-value v-sld/data 1 10000 h-base-val: map-slider-to-value h-sld/data 1 3000 clear head draw-cmds repeat row to-integer divide grd/size/y cell-size/y [ repeat col to-integer divide grd/size/x cell-size/x [ append draw-cmds compose [ text (to-pair reduce [ col - 1 * cell-size/x + 2 row - 1 * cell-size/y + 2 ]) (rejoin [ "R" to-integer (row - 1 + v-base-val) ":C" to-integer (col - 1 + h-base-val) ]) ] ] ] show grd ] lay: layout [ across space 1x1 grd: box 361x358 effect compose [grid (cell-size) draw []] v-sld: slider 15x358 [display-data] return h-sld: slider 361x15 [display-data] ] draw-cmds: grd/effect/draw display-data view lay