Rebol Programming/focus

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

USAGE:[edit | edit source]

FOCUS face /no-show 

DESCRIPTION:[edit | edit source]

Focuses key events on a specific face.

FOCUS is a function value.

ARGUMENTS[edit | edit source]

  • face -- (Type: any)

REFINEMENTS[edit | edit source]

  • /no-show

SOURCE CODE[edit | edit source]

focus: func [
    "Focuses key events on a specific face." 
    face 
    /no-show 
    /local tmp-face
][
    unfocus 
    if not face [exit] 
    focal-face: face 
    if not string? face/text [
        face/text: either face/text [form face/text] [copy ""] 
        face/line-list: none
    ] 
    if not caret [caret: tail face/text] 
    if none? face/line-list [
        if face/para [face/para/scroll: 0x0] 
        caret: tail face/text
    ] 
    if flag-face? face field [hilight-all face] 
    if not no-show [show face]
]