Pe0,
        Thanks for your help, I would not have worked out that it was necessary to
update both remote/lines and remote/data, although I think that I had tried
each individually.

Thanks once again for your help

Cheers
        colinb

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
P-O Yliniemi
Sent: Friday, April 20, 2001 10:19 AM
To: [EMAIL PROTECTED]
Subject: [REBOL] Re: Updating a text-list



Hi,

If you only update the remote-dir word when reading a new list of files from
another site, the text-list won't know about it.. You have to update the
text-list's data block:

    remote/lines: read to-url rejoin  ["ftp://" ftp_user ":" ftp_passwd "@"
hosts/picked]
    remote/data: copy remote/lines

I really don't know why I had to update both 'data' and 'lines', but the
text-list seemed to be confused if I only updated one of these.

You will also need to call the fix-slider function (see /View FAQ) to make
the text-list's slider knob match the amount of files.

The whole (a bit modified code, to suite my local net) follows:

[
REBOL []

ftp_user: "user"
ftp_passwd: "passwd"

ftp_hosts: ["172.16.0.1" "172.16.0.5"]
;ftp_hosts: ["Annapurna" "Enigma" "Etna" "Everest" "K2"]

ftp_host: first ftp_hosts

remote-dir: read to-url rejoin  ["ftp://" ftp_user ":" ftp_passwd "@"
ftp_host]

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
    ]
  ]
]

ui: [
  vh1 "FTP Client"
  box brick 250x1
  across label "Hosts:" tab hosts: text-list 100x100 data ftp_hosts
  tab remote: text-list 150x100 data remote-dir
  below
  box brick 250x1
  across button 60 "Connect" [
    remote/lines: read to-url rejoin  ["ftp://" ftp_user ":" ftp_passwd "@"
hosts/picked]
    remote/data: copy remote/lines
    show remote
    fix-slider remote
  ]
  across button 60 "Cancel" []
  across button 60 "Help" []
  across button 60 "Options" []
]

view layout ui

]


/PeO


> 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
>
>
--
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