From: "P-O Yliniemi"
> Here is a collection of text-list related problems I have gotten so
> far:
>
> 1. how do I set the slider to the 'correct' position on a rebuild ?

Sterling's /View beta fix was:

fix-slider: func [faces [object! block!]] [
    foreach list to-block faces [
        either 0 = length? list/data [
            list/sld/redrag 1
        ][
            list/sld/redrag list/lc / length? list/data
        ]
    ]
]

As was addressed two emails ago, I modified his for reasons that I don't
precisely recall, but if his doesn't work at some point, try:

; modification based on original by Sterling
; updates the bar on the side of a text-list or group of text-lists
fix-slider: func [faces [object! block!]] [
    foreach list to-block faces [
        either 0 = length? list/lines [
            list/sld/redrag 1
        ][
            list/sld/redrag list/lc / length? list/lines
        ]
    ]
]

These are used as such:
view layout [
    tl: text-list 100x50 "a" "b" "c" [
        tl/lines: ["new" "values" "for" "you"]
        fix-slider tl
        show tl
    ]
]

I don't recall the answer to #2 and I don't recall ever knowing how to do
#3, but I suspect it will require a custom face based on list, instead of
text-list.

Hope others know the answers.
--Scott Jones

> 2. is there a way to disable multi-selection of items in the list ?
> 3. how do I get rid of the white area below the last entry ?
>
> see the example for solutions on how to keep the previous
> item selection, and to have the same visible items in the list after
> the rebuild.
>
> -------------
> [
> REBOL []
>
> list-items: {some items to play around with in the list. Specific problems
I
>              have is all related to rebuilding the list}
>
> list-block: parse list-items " "
>
> build-layout: func [
>   {Build the test layout}
> ][
>   l: layout [
>     tl: text-list 100x140 data list-block [
>       if not none? tl/picked [ print first tl/picked ]
>     ]
>     button "Rebuild" [
>       old-picked: tl/picked           ; save old selection
>       old-sn: tl/sn                   ; save old visible area
>       build-layout                    ; rebuild
>       tl/picked: old-picked           ; initial selection is what was
before
>       tl/sn: old-sn                   ; make what was visible before
visible again
> ; how do I set the slider to the same position as before, or to match the
tl/sn value ?
>       view center-face l              ; view the layout
>     ]
>   ]
> ]
>
> build-layout
> view center-face l
> ]
>
> /PeO
> --
> To unsubscribe from this list, please send an email to
> [EMAIL PROTECTED] with "unsubscribe" in the
> subject, without the quotes.
>

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

Reply via email to