Rebol Programming/request-pass

From Wikibooks, open books for an open world
< Rebol Programming
Jump to navigation Jump to search

USAGE:[edit | edit source]

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

DESCRIPTION:[edit | edit source]

Requests a username and password.

REQUEST-PASS is a function value.

REFINEMENTS[edit | edit source]

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

SOURCE CODE[edit | edit source]

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:"]]) 
        (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]]]