Jump to content

Rebol Programming/find-key-face

From Wikibooks, open books for an open world

USAGE:

[edit | edit source]
FIND-KEY-FACE face keycode 

DESCRIPTION:

[edit | edit source]

Search faces to determine if keycode applies.

FIND-KEY-FACE is a function value.

ARGUMENTS

[edit | edit source]
  • face -- (Type: object)
  • keycode -- (Type: char word)

SOURCE CODE

[edit | edit source]
find-key-face: func [
    "Search faces to determine if keycode applies." 
    face [object!] keycode [char! word!] /local w f result
][
    either all [
        w: in face 'keycode 
        w: get w 
        any [keycode = w all [block? w find w keycode]]
    ] [face] [
        w: in face 'pane 
        either block? w: get w [
            result: none 
            foreach f w [if all [object? f f: find-key-face f keycode] [result: f break]] 
            result
        ] [
            if object? :w [find-key-face w keycode]
        ]
    ]
]