Using TAB to move between fields in Red language

我的未来我决定 提交于 2019-12-09 04:36:28

according 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]
]
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!