跳转至内容

Rebol 编程/request-pass

来自维基教科书,开放书籍,构建开放世界
REQUEST-PASS /offset xy /user username /only /title title-text 

请求用户名和密码。

REQUEST-PASS 是一个函数值。

  • /offset
    • xy -- (类型:任何)
  • /user
    • 用户名 -- (类型:任何)
  • /only -- 仅密码。
  • /title
    • 标题文本 -- (类型:任何)

源代码

[编辑 | 编辑源代码]
request-pass: func [
    "Requests a username and password." 
    /offset xy 
    /user username 
    /only "Password only." 
    /title title-text
][
    if none? user [username: copy ""] 
    pass-lay: layout compose [
        style tx text 40x24 middle right 
        across origin 10x10 space 2x4 
        h3 (either title [title-text] [either only ["Enter password:"] ["Enter username and password:"]]) 
        return 
        (either only [[]] [[tx "User:" userf: field username return]]) 
        tx "Pass:" pass: field hide [ok: yes hide-popup] with [flags: [return tabbed]] return 
        pad 140 
        btn-enter 50 [ok: yes hide-popup] 
        btn-cancel 50 #"^[" [hide-popup]
    ] 
    ok: no 
    focus either only [pass] [userf] 
    either offset [inform/offset pass-lay xy] [inform pass-lay] 
    all [ok either only [pass/data] [reduce [userf/data pass/data]]]
]
华夏公益教科书