REBOL Programming/request-dir

USAGE:Edit

REQUEST-DIR /title title-line /dir where /keep /offset xy 

DESCRIPTION:Edit

Requests a directory using a popup list.

REQUEST-DIR is a function value.

REFINEMENTSEdit

  • /title -- Change heading on request.
    • title-line -- (Type: any)
  • /dir -- Set starting directory
    • where -- (Type: file)
  • /keep -- Keep previous directory path
  • /offset
    • xy -- (Type: any)

SOURCE CODEEdit

request-dir: func [
    "Requests a directory using a popup list." 
    /title "Change heading on request." title-line 
    /dir "Set starting directory" where [file!] 
    /keep "Keep previous directory path" 
    /offset xy
][
    if block? dirout [
        dirout: layout dirout 
        max-dirs: to-integer f-list/size/y - 4 / f-txt/size/y 
        center-face dirout
    ] 
    set-face f-title any [title-line "Select a directory:"] 
    if not all [keep path] [
        path: copy either where [clean-path where] [what-dir]
    ] 
    if all [not empty? path slash = last path] [remove back tail path] 
    last-path: path 
    result: none 
    show-dir 
    either offset [inform/offset dirout xy] [inform dirout] 
    result
]
Last modified on 13 November 2012, at 10:51