[REBOL] Re: Updating a text-list
From: gjones05:mail:orion at: 20-Apr-2001 8:35
From: "Colin Brizell"
> Hi list,
> The attached script produces a directory listing of the remote home
> directory of "user" on host "Everest" on startup. When however I select
> another
> host eg. "Etna" the directory list is not being updated although
remote-dir:
> does contain the correct data if I print it to the console.
>
> PLEASE can someone point out the error of my ways
>
> Regards
> colinb
>
> REBOL [
> ]
>
> remote-dir: read to-url join "ftp://user:passwd@" "Everest"
> ui: [
> vh1 "FTP Client"
> box brick 250x1
> across label "Hosts:" tab hosts: text-list 100x100 data ["Annapurna"
> "Enigma" "Etna" "Everest" "K2"]
> tab remote: text-list 150x100 data remote-dir
> below
> box brick 250x1
> across button 60 "Connect" [
> remote-dir: mold read to-url join "ftp://user:passwd@" hosts/picked
> show remote ]
> across button 60 "Cancel" []
> across button 60 "Help" []
> across button 60 "Options" []
> ]
>
> view layout ui
> Colin Brizell
Hi, Colin,
I offer an alternative to PeO's mainly as a way to demonstrate a few other
pointers I've been picking up along the way. This solution doesn't mess
with /data path on updates. I, also moved slide fixer to before show.
Notice the 'do, which allows the dialog to do kick-off the data on first
draw, which allows one fewer assignments and, therefore, one fewer words to
keep track of. Needless to say I wasn't able to test this exact script
because of the ftp setup, but it should hopefully work if I didn't mess it
up switching back to your setup.
;refactored slide fixer, now similar to original definition in code
fix-slider: func [faces [object! block!]] [
foreach list to-block faces [
list/sld/redrag list/lc / max 1 length? head list/lines
]
]
ui: [
vh1 "FTP Client"
box brick 250x1
across label "Hosts:"
tab hosts: text-list 100x100 data ["Annapurna" "Enigma" "Etna" "Everest"
K2
]
tab remote: text-list 150x100
do [
remote/lines: read to-url join "ftp://user:passwd@" "Everest"
fix-slider remote
show remote
]
below
box brick 250x1
across button 60 "Connect" [
;dropped the 'mold since it didn't appear necessary
remote/lines: read to-url join "ftp://user:passwd@" hosts/picked
fix-slider remote
show remote
]
across button 60 "Cancel" []
across button 60 "Help" []
across button 60 "Options" []
]
view layout ui
--Scott Jones