Hi Romano,

Did you notice that it is possible to move the
right slider without having the mouse button
pressed? If you click, drag & release quickly,
I think the 'up event gets filtered away sometimes?

Anton.

> This little hack to speed up view.
>
> I think that something like this should be present at native
> level in View.
>
> ---
> Ciao
> Romano
>
> ------
> rebol [
>     Title: "Eat"
>     Author: "Italian Connexion (Gabriele Santilli - Romano Paolo Tenca)"
>     Purpose: "Event filtering --- speeds up view!"
> ]
> context [
>     ;the words of this context are the event/type to compress
>     no-queue: context []
>     wake-event: func [event /local no-btn] bind [
>         either not pop-face [
>             do event
>             empty? screen-face/pane
>         ][
>             either any [pop-face = event/face within?
> event/offset win-offset?
> pop-face pop-face/size] [
>                 no-btn: false
>                 if block? get in pop-face 'pane [
>                     no-btn: foreach item pop-face/pane [if get in
> item 'action
> [break/return false] true]
>                 ]
>                 if any [all [event/type = 'up no-btn] event/type = 'close]
> [hide-popup]
>                 do event
>             ] [
>                 if pop-face/action [
>                     if not find [move time] event/type [hide-popup]
>                     do event
>                 ]
>             ]
>             none? find pop-list pop-face
>         ]
>     ] in system/view 'self
>     awake: func [port no-queue /local event events lasttype] [
>         events: clear []
>         while [event: pick port 1] [
>             either all [in no-queue event/type lasttype = event/type] [
>                 change back tail events event
>             ] [
>                 lasttype: event/type
>                 insert tail events event
>             ]
>         ]
>         foreach event events [
>             if wake-event event [return true]
>         ]
>         false
>     ]
>     system/ports/wait-list/1/awake: func [port] [awake port no-queue]
>     to-ob: func [blk [block!]][
>         blk: copy blk
>         forall blk [change blk to-set-word first blk]
>         context insert blk none
>     ]
>     free: true
>     set 'eat func [
>         /forever for [block!]
>         /only blk [block!]
>     ][
>         either forever [
>             no-queue: to-ob for
>         ][
>             if not only [blk: [move key offset scroll-line scroll-page]]
>             if all [free not empty? blk][
>                 free: false
>                 awake system/view/event-port to-ob blk
>                 free: true
>             ]
>         ]
>     ]
> ]
> print {
>     Example:
>
>         to compress all the events of type 'offset and 'move:
>
>             eat/forever [offset move]
>
>         to remove all events compression:
>
>             eat/forever []
>
>         to compress only once (at the end of a VID action for example)
>         the events of type [move key offset scroll-line scroll-page]:
>
>             eat
>
>         to compress only once the events of type 'move 'scroll-line
> 'scroll-page:
>
>             eat/only [move scroll-line scroll-page]
>
> }
> e: ne: 1
> delay: 500000
> view layout [
>     area 200x50 wrap "Try to move the slider up and down keeping the left
> button pressed and see the difference"
>     guide
>     text white "Standard"
>     slider [print ["pressed not eated" ne] ne: ne + 1 loop delay []]
>     return
>     pad 100
>     return
>     text white "Eated"
>     slider [print ["pressed eated    " e] e: e + 1 loop delay [] eat/only
> [move]]
> ]
> halt

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to