Hi Maxim,

On Wednesday, January 21, 2004, 12:23:35 AM, you wrote:

MOA> Is anyone capable of getting keyboard events for faces
MOA> which are not "focused", short of rewriting the whole event
MOA> handler?

This  is  a  modified  window  feel I use in some applications; it
allows to focus any face using CUSTOM-FOCAL-FACE. You just need to
set  it  to the face you want to focus. (You might want to discard
all the other changes.)

; support for custom-focal-face
insert tail second :unfocus
[   if object? get/any 'custom-focal-face [custom-focal-face: none]]

; new window feel, to catch active, inactive and close.
; update: catch keys too, but without interfering with focused faces; 
; also, now the whole event is passed to window/action
; update: now ESC unfocuses, too
; update: custom-focal-face added
system/view/window-feel:
    make system/view/window-feel
    [   detect:
            func [face event /local f]
            [   either event/type = 'key
                [   either all [system/view/focal-face in-window? face 
system/view/focal-face]
                    [   if event/key = #"^(1B)"
                        [   unfocus]
                        event
                    ]
                    [   either all [object? get/any 'custom-focal-face in-window? face 
custom-focal-face]
                        [   custom-focal-face/feel/engage custom-focal-face 'key event
                            none
                        ]
                        [   do-face face event
                            either f: find-key-face face event/key
                            [   do-face f event
                                none
                            ]
                            [   event]
                ]   ]   ]
                [   if find [close active inactive] event/type
                    [   do-face face event]
                    event
    ]       ]   ]

Regards,
   Gabriele.
-- 
Gabriele Santilli <[EMAIL PROTECTED]>  --  REBOL Programmer
Amiga Group Italia sez. L'Aquila  ---   SOON: http://www.rebol.it/

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.

Reply via email to