double-click check function
[1/2] from: peoyli::algonet::se at: 14-Apr-2001 13:46
Hi,
Noticed that there were no such thing yet so... Almost lile AmigaOS/Intuition
function DoubleClick()
/PeO
[
REBOL []
double-click?: func [
starttime [time!] {The timestamp value describing the start of the
double-click period you are considering}
currenttime [time!] {The timestamp value describing the end of the
double-click time period you are considering}
timeout [time!] {The double-click timeout value}
][
if currenttime - starttime <= timeout [
return true
]
return false
]
;------------------------- Example ----------------------------------
; Maybe there is an easier way to use the function ?
;
; The first either.. is to not count double-clicks between different
; lines in the list (clicking for example "a" and "b" within the
; specified timeout value). The second does the actual double-click
; check.
time1: 0:0:0
val1: ""
view layout/offset [
l: text-list 100x200 data ["a" "b" "c"] [
time2: now/time/precise
val2: to-string l/picked
either val1 = val2 [
either double-click? time1 time2 0:0:0.5 [ ; time within double-click
print [l/picked "double-clicked"]
][
time1: time2
]
][
val1: val2
time1: time2
]
]
] 700x800
]
[2/2] from: peoyli:algonet:se at: 16-Apr-2001 0:05
> Hi,
>
> Noticed that there were no such thing yet so... Almost lile AmigaOS/Intuition
> function DoubleClick()
>
> /PeO
...
> ;------------------------- Example ----------------------------------
...
> view layout/offset [
> l: text-list 100x200 data ["a" "b" "c"] [
> time2: now/time/precise
change to..
time2: now/precise time2: time2/time + to-time join time2/date - 1-Jan-1970 * 24 ":00"
to prevent double-clicks to occur between day changes (00:00:01 - 23:59:50 -23:59:49,
which is always less than the specified double-click timeout)
/PeO