Paste: temperature-gadget
Author: | dharmatech |
Mode: | factor |
Date: | Fri, 5 Dec 2008 03:23:37 |
Plain Text |
USING: accessors locals math models.range range-model-label
range-model-tie ui ui.gadgets ui.gadgets.packs
ui.gadgets.sliders ;
IN: temperature-gadget
: f->c ( f -- c ) 32 - 5/9 * ;
: temperature-gadget ( -- gadget )
[let | FAHRENHEIT [ 32 1 32 212 <range> ]
CELSIUS [ 0 1 0 100 <range> ] |
FAHRENHEIT CELSIUS [ f->c ] range-model-tie
<pile> 1 >>fill
"Fahrenheit:" FAHRENHEIT range-model-label add-gadget
FAHRENHEIT <x-slider> add-gadget
"Celsius:" CELSIUS range-model-label add-gadget
CELSIUS <x-slider> add-gadget ] ;
: main ( -- ) [ temperature-gadget "Temperature" open-window ] with-ui ;
MAIN: main
New Annotation