跳转到内容

Rebol 编程/request-dir

来自维基教科书,开放世界中的开放书籍
REQUEST-DIR /title title-line /dir where /keep /offset xy 

使用弹出列表请求目录。

REQUEST-DIR 是一个函数值。

  • /title -- 更改请求标题。
    • title-line -- (类型:任何)
  • /dir -- 设置起始目录
    • where -- (类型:文件)
  • /keep -- 保留上一个目录路径
  • /offset
    • xy -- (类型:任何)

源代码

[编辑 | 编辑源代码]
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
]
华夏公益教科书