跳轉到內容

Rebol 程式設計/view

來自華夏公益教科書
VIEW view-face /new /offset xy /options opts /title text 

顯示一個視窗介面。

VIEW 是一個函式值。

  • view-face -- (型別:物件)
  • /new -- 建立一個新視窗並立即返回
  • /offset
    • xy -- 視窗在螢幕上的偏移量 (型別:對)
  • /options
    • opts -- 視窗選項 [no-title no-border resize] (型別:塊字)
  • /title
    • text -- 視窗欄標題 (型別:字串)

原始碼

[編輯 | 編輯原始碼]
view: func [
    "Displays a window face." 
    view-face [object!] 
    /new "Creates a new window and returns immediately" 
    /offset xy [pair!] "Offset of window on screen" 
    /options opts [block! word!] "Window options [no-title no-border resize]" 
    /title text [string!] "Window bar title" 
    /local scr-face
][
    scr-face: system/view/screen-face 
    if find scr-face/pane view-face [return view-face] 
    either any [new empty? scr-face/pane] [
        view-face/text: any [
            view-face/text 
            all [system/script/header system/script/title] 
            copy ""
        ] 
        new: all [not new empty? scr-face/pane] 
        append scr-face/pane view-face
    ] [change scr-face/pane view-face] 
    if all [
        system/view/vid 
        view-face/feel = system/view/vid/vid-face/feel
    ] [
        view-face/feel: window-feel
    ] 
    if offset [view-face/offset: xy] 
    if options [view-face/options: opts] 
    if title [view-face/text: text] 
    show scr-face 
    if new [do-events] 
    view-face
]
華夏公益教科書