Rebol Programming/request-text

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

USAGE:[edit | edit source]

REQUEST-TEXT /offset xy /title title-text /default str 

DESCRIPTION:[edit | edit source]

Requests a text string be entered.

REQUEST-TEXT is a function value.

REFINEMENTS[edit | edit source]

  • /offset
    • xy -- (Type: any)
  • /title
    • title-text -- (Type: any)
  • /default
    • str -- (Type: any)

SOURCE CODE[edit | edit source]

request-text: func [
    "Requests a text string be entered." 
    /offset xy 
    /title title-text 
    /default str
    if none? str [str: copy ""] 
    text-lay: layout compose [
        across origin 10x10 space 2x4 
        h3 bold (either title [title-text] ["Enter text below:"]) 
        tf: field 300 str [ok: yes hide-popup] with [flags: [return]] return 
        pad 194 
        btn-enter 50 [ok: yes hide-popup] 
        btn-cancel 50 #"^[" [hide-popup]
    ok: no 
    focus tf 
    either offset [inform/offset text-lay xy] [inform text-lay] 
    all [ok tf/text]