[REBOL] Multi-Click
From: ammon::rcslv::com at: 28-Jun-2002 15:13
Hi,
looking for Frank Sievertsen. He is the author of a multi-click function
which I would like to discuss with him...
Here is the function (hopefully it doesn't wrap too bad):
multi-click: func [
"Checks for multi-click"
face [object! word! number! any-string!]
"The clicked face or id"
clicks [block!] "What to do?"
/max "Set double-click time"
max-time [time!] "default: 00:00:00.3"
/right "Right mouse button"
/local mem tmp
] [
mem: [0 1-1-01/0:0 0 1-1-01/0:0 0 ]
if right [mem: skip mem 3]
if not max [max-time: 0:0:0.3]
either all [
same? face mem/1
mem/2 + max-time >= now/precise
] [
mem/3: mem/3 + 1
do pick clicks mem/3 + 1
] [
mem/3: 0
mem/1: face
do pick clicks 1
none
]
mem/2: now/precise
]
in the "either all" clause there, what is the purpose of "same? face mem/1"?
what would it take to make it location aware? So that if the user happens to
move his mouse across the screen and click again before the max time is
reached he doesn't multi-click? From what I can see you would need to have a
word that was available to multiple instances of the same function. A word
that wasn't reset each time the function is called. Any ideas?
Thanks!!
Ammon