I found a script in www.rebolforce.com  with a new widget : the dropdown widget.
The code of this widget is :

dropdowns: stylize [
    dropdown: text 
    black white 100 edge [color: 110.120.130 size: 2x2 effect: 'ibevel] 
    font [shadow: none]
    middle
    with [
        list-lay: none
        show-arrow?: true
        rows: 4
        size: 100x24
        line-list: action: none
        list-data: copy []
        dd-feel: make face/feel [
            over: redraw: detect: none
            engage: func [face action event][
                switch action [
                    time [if not face/state [face/blinker: not face/blinker]]
                    down [face/state: on]
                    alt-down [face/state: on]
                    up [if face/state [face/show-dropdown] face/state: off]
                    alt-up [if face/state [do-face-alt face none] face/state: off]
                    over [face/state: on]
                    away [face/state: off]
                ]
                show face
            ]
        ]
        arrow-button: does [
            layout [
                origin 0x0 arrow down [self/show-dropdown] 
                edge [color: 110.120.130 size: 2x2 effect: 'ibevel] 128.128.128 14x20
            ]
        ]
        show-dropdown: func [/local tl picked][
             if not list-lay [
                 list-lay: layout [
                     origin 0x0 at 0x0
                     tl: text-list data self/list-data bold to-pair reduce [size/x  
rows * 15 + 4]
                     self/font/color self/color 
                     [ self/data: self/text: value show list-lay 
                       wait 0:0:0.03 ; long enough to see selection
                       hide-popup show self
                     ]
                     do [if picked: find self/list-data self/text [append clear 
tl/picked first picked]]
                 ]
                 list-lay/offset: to-pair reduce [self/offset/x self/offset/y + 
self/size/y]
            ]
            show-popup/window list-lay self/parent-face
            do-my-events/away list-lay
            do-face self self/data
         ]
         reset: does [list-lay: none]
         resize: does [
            reset ; so list-pane will redraw at correct size
            {Reset if a change has been made to the data}
            size/x: max 32 size/x
            size/y: max 24 size/y 
            either show-arrow? [
                pane: arrow-button
                pane/offset: 0x0 pane/offset/x: self/size/x - arrow-button/size/x - 4
                arrow-button/size/y: self/size/y
            ][pane: none]
            show self
         ]
        pane: none
        words: [data [new/list-data: second args next args]
                rows [new/rows: second args next args]]
        init: append copy init [
             arrow-button: arrow-button
             resize    
             self/feel: self/dd-feel
        ]
    ]
] 


It appears that this widget doesn't operate in the new version of Rebol/view
like it did with the previous version because the do-events function is not
the same.

In the previous version of Rebol/View, the do-events function was :

do-events: func [
    "Process all View events."
    /only "Restrict events to only a single window face" face
    /away "Same as only, but event outside cancels" wf
    /ports port-block [block!] "Port/action dispatch list"
    /local flag event no-btn
][
    if away [only: true face: wf]
    wf: either all [only face/parent-face] [face/parent-face/pane] 
[system/view/screen-face/pane]
    if not flag: event-port [event-port: open [scheme: 'event]]
    ports: reduce [event-port]
    either port-block [
        foreach [port job] port-block: reduce port-block [
            if any [number? port time? port] [if none? timeblk [timeblk: :job]]
            append ports port
        ]
    ] [port-block: copy []]
    insert/only port-block either only [
        if block? get in face 'pane [
            no-btn: foreach item face/pane [if get in item 'action [break/return 
false] true]
        ]
        [
            event: first event-port
            either any [
                event/face = face
                within? event/offset win-offset? face face/size
            ] [
                if any [all [event/type = 'up no-btn] event/type = 'close] [hide-popup 
break]
                do event
            ] [
                if away [
                    if not find [move time] event/type [hide-popup]
                    do event
                ]
            ]
        ]
    ] [[do first event-port]]
    insert/only port-block event-port
    while either only [[find wf face]] [[not empty? wf]] [
        either awake: wait/all ports [
            foreach item awake [
                set/any 'result do select port-block item item
                if all [value? 'result 'break = :result] [break]
            ]
            if all [value? 'result 'break = :result] [break]
        ] [do :timeblk]
    ]
    if not flag [close event-port event-port: none]
]

And now the do-events function source is :

do-events: func [
    "Process all View events."
][
    wait []
]

Can anyone expain me how to do now ?

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

Reply via email to