[REBOL] Re: Make_user_manual.r ?
From: brett:codeconscious at: 24-Jan-2002 0:11
Hi Sunanda,
Thanks for you overly kind email!
As for the searching functions we talked about, try these (which are totally
due to the fact that I looked at the source of find-key-face):
; Used logic of find-key-face.
find-face: func [
"Search faces - returns first that results in the function evaluating to
true."
face [object!]
funct [block! function!] "A function or a function body block"
/local w f result
] [
if block? :funct [funct: func [face] funct]
either funct face [face] [
w: in face 'pane
either block? w: get w [
result: none
foreach f w [if all [object? f f: find-face f :funct] [result: f
break]]
result
] [
if object? :w [find-face w :funct]
]
]
]
find-faces: func [
"Search faces - returns those that result in the function evaluating to
true."
face [object!]
funct [block! function!] "A function or a function body block"
/local w f result
] [
if block? :funct [funct: func [face] funct]
result: copy []
if funct face [append result face]
w: in face 'pane
either block? w: get w [
foreach f w [if all [object? f] [append result find-faces f :funct]]
] [
if object? :w [append result find-faces w :funct]
]
result
]
; Example - find one face
fce: find-face lyo: layout [
text "one"
text "two"
box "three"
] [equal? face/text "two"]
fce/color: red
view lyo
; Example - find multiple faces
repeat fce find-faces lyo: layout [
text "one"
text "two"
box "one"
] [equal? face/text "one"] [fce/color: yellow]
view lyo
So searching is pretty much done.
> 3. Handle alt-action ("right click")
DO-FACE-ALT should do it.
Will keep the other of your points in mind.
Brett.