rebol2视频应用程序中的请求日期



谁能告诉我为什么下面的代码不工作?它应该在加载时在字段中设置日期,然后通过单击该字段允许更改日期。我在linux上使用rebol/view 2.7.8。实际上,我认为这段代码在几年前我使用MS Windows时是可以工作的,但由于某种原因在linux下不行。

drl

    rebol []
    trace true
    out: layout [
        style dater txt bold right [trans-date/date: copy (form now/date)] 48x24
        dater "T-Date:" trans-date: field 80x24 (form now/date) feel [
            engage: func [face action event][
                if action = 'up [
                    lv-dat: request-date/date/offset (now/date) 450x375
                    if lv-dat <> none [
                        trans-date/text: form lv-dat
                        show trans-date
                    ]
                ]
            ]
            show trans-date
        ]
    ]
    view out  

这是你的代码的清理版本:

Rebol []
out: layout compose/deep [
    style dater txt bold right 48x24
    dater "T-Date:"
    trans-date: field 80x24 (form now/date) feel [
        engage: func [face action event][
            if action = 'up [
                lv-dat: request-date/date/offset (now/date) 450x375
                if lv-dat [
                    face/text: form lv-dat
                    show face
                ]
            ]
        ]
    ]
]
view out

主要问题是在调用layout之前缺少compose/deep调用来计算父表达式。然而,这种方法不是初始化人脸属性的常用方法,你应该把初始化代码放在VID块的do部分,像这样:

Rebol []
out: layout [
    style dater txt bold right 48x24
    dater "T-Date:"
    trans-date: field 80x24 feel [
        engage: func [face action event][
            if action = 'up [
                lv-dat: request-date/date/offset now/date 450x375
                if lv-dat [
                    face/text: form lv-dat
                    show face
                ]
            ]
        ]
    ]
    do [trans-date/text: form now/date]
]
view out

相关内容

  • 没有找到相关文章

最新更新