Paste: Incomplete ui

Author: Factor
Mode: factor
Date: Wed, 31 Mar 2010 00:16:57
Plain Text |
! Copyright (C) 2010 Søren Enevoldsen.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays kernel math math.parser models models.product models.arrow namespaces sequences ui ui.gadgets
ui.gadgets.buttons ui.gadgets.editors ui.gadgets.labels ui.gadgets.packs ;
IN: coords

SYMBOL: result-model

: <line-input> ( model -- model-field ) <model-field> { 15 120 } >>dim { 5 5 } >>size ;

: update-result ( product -- ) [ number>string ] map dup [ number? ] all?
    [ 0 [ + ] reduce result-model get set-model ] [ drop ] if ;

: left-side ( -- gadget ) <pile> "Distance" <model>
    { { "Distance" "Afstand" } { "Translation" "Flyt" } }
    <radio-buttons> add-gadget ;

: right-side ( -- gadget ) <pile>
    <shelf> "0" <model> <line-input> add-gadget
        "0" <model> <line-input> add-gadget add-gadget
    <shelf> "0" <model> <line-input> add-gadget
        "0" <model> <line-input> add-gadget add-gadget
    <shelf> "Result: " <label> add-gadget "0" <model> <line-input> add-gadget add-gadget ;

: create-ui ( -- ) [ <shelf> { 20 5 } >>gap
    left-side add-gadget right-side add-gadget
    "Coordinates" open-window ] with-ui ;

MAIN: create-ui

New Annotation

Summary:
Author:
Mode:
Body: