跳轉到內容

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
]
華夏公益教科書