Intercept key press
[1/7] from: davidegessi::tin::it at: 12-Dec-2002 18:19
Hi all,
sorry for the beginner question..
I'm making my first Rebol app, a msn messenger clone. It's in early stage
stage of developing but is working ! :)
A nice feature of the protocol of msn messenger is the information about the
other user "is typing a message" (so one would wait for an answer), so how
can I intercept the key press in a field ?
The problem is:
if I rewrite the "engage" object I can intercept the key but the standard
handler isn't called, how can I call the standard edit handle for a field
from the engage event ?
Thanks all in advance
Davide
[2/7] from: carl:s:rebol at: 12-Dec-2002 14:56
You'd want to catch it with the Detect function, then return the event as
the result to let it get processed normally. Detect works from the top
down, whereas Engage works from the bottom up.
PS: We are working on a new doc to explain all this in much more detail.
At 06:19 PM 12/12/02 +0100, you wrote:
>Hi all,
>sorry for the beginner question..
<<quoted lines omitted: 17>>
>[rebol-request--rebol--com] with "unsubscribe" in the
>subject, without the quotes.
-Carl
REBOL Chief
[3/7] from: davidegessi:tin:it at: 13-Dec-2002 2:50
> -----Original Message-----
> From: [rebol-bounce--rebol--com] [mailto:[rebol-bounce--rebol--com]]On Behalf Of
<<quoted lines omitted: 6>>
> down, whereas Engage works from the bottom up.
> PS: We are working on a new doc to explain all this in much more detail.
Umh, probably Carl you are a newbie like me in Rebol.... your answer didn't
work for me... :):):)
No, just kidding, but I feel I'll win the first prize for the worst
programmer of this ML ...
My code is:
view layout [f: field feel [detect: func [face event] [print ["event:"
event/type] event]]]
I'm using detect but seems that prints occour only with mouse event.
Davide
[4/7] from: anton:lexicon at: 13-Dec-2002 17:08
Hi Davide,
This example modifies the feel of the window face:
view/new lay: layout [
my-field: field my-field2: field
]
lay/feel: make lay/feel [
detect: func [face event][
if event/type = 'key [
print [
event/key
all [
system/view/focal-face
system/view/focal-face/var
]
]
]
event ; return the event
]
]
wait none
(view sets the window feel, that's why you need to
specifically view/new, set your feel,
then wait for events afterwards.)
Anton.
[5/7] from: petr:krenzelok:trz:cz at: 13-Dec-2002 8:33
Carl at REBOL wrote:
> You'd want to catch it with the Detect function, then return the event
> as the result to let it get processed normally. Detect works from the
> top down, whereas Engage works from the bottom up.
>
> PS: We are working on a new doc to explain all this in much more detail.
Carl, would it be possible to add key-up event detection?
-pekr-
[6/7] from: davidegessi:tin:it at: 13-Dec-2002 6:53
Nevermind, I've made it using engage.. thanks anyway
Davide
[7/7] from: davidegessi:tin:it at: 13-Dec-2002 16:17
> -----Original Message-----
> From: [rebol-bounce--rebol--com] [mailto:[rebol-bounce--rebol--com]]On Behalf Of
<<quoted lines omitted: 26>>
> then wait for events afterwards.)
> Anton.
Thanks Anton, now it's clear ! I'll use your code.
Davide
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted