Rebol Programming/request-pass

USAGE:

edit
REQUEST-PASS /offset xy /user username /only /title title-text 

DESCRIPTION:

edit

Requests a username and password.

REQUEST-PASS is a function value.

REFINEMENTS

edit
  • /offset
    • xy -- (Type: any)
  • /user
    • username -- (Type: any)
  • /only -- Password only.
  • /title
    • title-text -- (Type: any)

SOURCE CODE

edit
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]]]
]