2017-10-25 7 views
0

私は、単純なコード次き:レッド言語でフィールド間を移動するにはTABを使用し

Red [] 
view [ 
    text "Value of x:" f1: field "" return 
    text "Value of y:" f2: field "" return 
    text "Read Sum:" tt: text "" return 
    button "Calculate" [ 
     tt/text: to-string ((to-integer f1/text) + (to-integer f2/text)) ] 
    button "Quit" [quit] ] 

1がTABキーを使用して、異なるフィールド間を移動できるように、どのようにコードを追加することができますか?どうやら、これはRebol(http://www.rebol.com/how-to/fields.html)で動作しますが、ここでは動作しません。 `ボタン "計算"[TT /データ:F1 /データあなたとあなたのコードを簡素化することができるように

答えて

2

応じgitter archive

handle-key: function [e prev-fld next-fld][ 
    k: e/key 
    if k = tab [ 
     either e/shift? [win/selected: prev-fld][win/selected: next-fld] 
    ] 
] 
view [ 
    text "Value of x:" f1: field "" on-key [handle-key event tt f2] return 
    text "Value of y:" f2: field "" on-key [handle-key event f1 tt] return 
    text "Read Sum:" tt: text "" on-key [handle-key event f2 f1] return 
    button "Calculate" [ 
     tt/text: to-string ((to-integer f1/text) + (to-integer f2/text))  
    ] 
    button "Quit" [quit] 
    do [win: self win/selected: f1] 
] 
+0

ビューは現在、text'と'あなたのためのfield'コンテンツ 'のための変換を処理することができます+ f2/data] 'となります。 – DocKimbel

関連する問題