It would probably be a lot easier to use a List rather than
a text-list.  Once you get the hang of a list, there's a lot
more you can do with them.

Here's example of a list... this one has alternating
row colors.  For data, it uses files in local dir.

REBOL [
        Title: "Example List"
        Date: 14-Mar-2000
        Author: "Carl Sassenrath"
]

cnt: 0
files: load %./

out: layout [
        across
        image logo.gif
        text 233x24 bold middle no-wrap reform ["File List" now/date now/time]
        return space 0
        txt snow black "Size" 77 center bold
        txt snow black "Time" 55 center bold
        txt snow black "File" 266 bold
        return
        lst: list 380x300 [
                origin 0 space 0x0 across
                txt 75 center para [origin: margin: 0x2]
                txt 55 center para [origin: margin: 0x2]
                txt bold 240
                txt 10
        ] supply [
                count: count + cnt
                face/color: ivory
                face/text: none
                face/font/color: black
                if even? count [face/color: ivory - 50.50.50]
                if none? file: pick files count [exit]
                face/text: do pick [
                        [either dir? file ["dir"][size? file]]
                        [if date: modified? file [date/time]]
                        [file]
                ] index
        ]
        sld: slider lst/size * 0x1 + 16x0 [
                c: to-integer value * .5 * length? files
                if c <> cnt [cnt: c show lst]
        ] return
]

view out

-Carl

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
> P-O Yliniemi
> Sent: Tuesday, April 17, 2001 10:48 AM
> To: [EMAIL PROTECTED]
> Subject: [REBOL] Re: text-list questions (probably answered before)
> 
> 
> > > 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 ?
> > > 
> 
> ah.. almost there (by poking around in the text-list object).. now.. how
> do stop the slider knob from jumping from the top of the container to the
> position I want it in ?
> 
> The value I poke at is:
> tl/sld/pane/offset
> 
> where 'tl' is my text-list in the layout.
> 
> I want the initial position to be set to the old position..
> 
> [
> 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 ]
>       print tl/sld/pane/offset
>     ]
>     button "Rebuild" [
>       old-picked: tl/picked           ; save old selection
>       old-sn: tl/sn                   ; save old visible area
>       old-sld-offset: tl/sld/pane/offset
> 
>       build-layout                    ; rebuild
>       tl/picked: old-picked           ; initial selection is what 
> was before
>       tl/sn: old-sn                   ; make what was visible 
> before visible again
>       view center-face l              ; view the layout
>       tl/sld/pane/offset: old-sld-offset
>       show tl
>     ]
>   ]
> ]
> 
> 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