Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Updating a text-list

 [1/16] from: c:brizell:worc:ac at: 20-Apr-2001 8:01


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 IT Service E-Mail: [c--brizell--worc--ac--uk] Tel: 01905 855389 Fax: 01905 855330 http://www.worc.ac.uk

 [2/16] from: peoyli:algonet:se at: 20-Apr-2001 11:19


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

 [3/16] from: c:brizell:worc:ac at: 20-Apr-2001 11:22


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

 [4/16] 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
<<quoted lines omitted: 20>>
> 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

 [5/16] from: c:brizell:worc:ac at: 21-Apr-2001 7:46


Scott, Thanks for you input. This list, certainly the people on it, are a _great_ help. Thanks colinb

 [6/16] from: moeller_thorsten:gmx at: 6-Jul-2001 13:21


Hi, i have layout with an area, a button and a text-list. I want to enter some code in the area, press the button and show the result of the code in the text-list. How can i do this? Anybody there to help me out? Thorsten

 [7/16] from: carl:cybercraft at: 7-Jul-2001 0:26


On 06-Jul-01, Thorsten Moeller wrote:
> Hi, > i have layout with an area, a button and a text-list. I want to
<<quoted lines omitted: 3>>
> Anybody there to help me out? > Thorsten
Not sure if this is what you mean, but entering some REBOL code, ("10 + 10", "now" etc.) in the area of the following layout and pressing the button will add the result to the top of the list... view layout [ a-area: area a-list: text-list button "Process" [ result: do a-area/text insert a-list/data result show a-list ] ] -- Carl Read [carl--cybercraft--co--nz]

 [8/16] from: coussement:c:js:mil:be at: 6-Jul-2001 14:48


Hi Throsten: Just a quick hack. Try : view layout [ across ar: area 200x200 gold tl: text-list 200x200 return button "Update" [ append tl/data do reduce ar/text show tl ] ] It should work for any do-able regular expression which produce an output. Try: 1 + 1 'text hello length? "hello" exists? %foo hope this helps, chr==

 [9/16] from: moeller_thorsten:gmx at: 6-Jul-2001 22:02


Hi, thanks to you little helpers from the list. Again save the day. It is every time amazing how productive the work with this list is. Keep it working. Thanks Thorsten

 [10/16] from: rotenca:telvia:it at: 7-Jul-2001 1:22


CRS - Psy Sel/SPO, COUSSEMENT, Christophe, CPN <[COUSSEMENT--C--js--mil--be]>
> button "Update" [ > append tl/data do reduce ar/text > show tl > chr==
I have not found any documentation, but in a Carl Sassenrath script (view-ref.r), i have found: if value? 'f-funcs [ f-funcs/texts: f-funcs/lines: f-funcs/data: words f-funcs/sn: f-funcs/sld/data: 0 f-funcs/sld/redrag f-funcs/lc / length? words show f-funcs ] Where f-func is the text-list and words the list of lines. In my test, lines seem the only to work from an action in the text list body. Can someone say something about use and differences among text-list's: data texts lines lc sld/redrag ? ciao (my english is bad) romano paolo tenca

 [11/16] from: brett:codeconscious at: 10-Jul-2001 0:34


Hi Volker, Could you explain to me what the code you added does? I'm not sure what a size-change is. Thanks Brett.

 [12/16] from: agem:crosswinds at: 9-Jul-2001 19:12


RE: [REBOL] Re: updating text-list [brett--codeconscious--com] wrote:
> Hi Volker, > > Could you explain to me what the code you added does? I'm not sure what a > size-change is.
oops. change of length? lines . you do append tl/lines something tl/update-slider show tl many rebol-words have a check in feel/redraw for their state, so one can say face/state: on show face and in redraw there is color: either state[blue][white] i added a similar way to do append tl/lines something show tl ;update slider automatic just a little feature ;-) -Volker

 [13/16] from: brett:codeconscious at: 10-Jul-2001 11:24


> i added a similar way to do > append tl/lines something > show tl ;update slider automatic > > just a little feature ;-)
Ahh... Tricky :-) Brett.

 [14/16] from: moeller_thorsten:gmx at: 8-Jul-2001 8:39


Hi Carl, Chris, i have to come back to inserting things in text-lists. the insert data itself works well. The problem i encounteredis, that the slider functionality doesn't work after the insert. I just put in a directory listing in and only see the to, no chance to get to the end, not with insert, nor with append. Any ideas? Has anybody had this problem before? Thorsten

 [15/16] from: brett:codeconscious at: 8-Jul-2001 17:19


Hi Thorsten, It appears that one needs to update the slider. Here's one way to go that uses a new style to define a function that updates the slider. view layout [ style updatable-text-list text-list with [ update-slider: does [ sld/redrag lc / max 1 length? head lines ] ] tl: updatable-text-list 300x100 data copy system/locale/months button "Delete first" [ remove tl/data tl/update-slider show tl ] button "Append now" [ append tl/data mold now tl/update-slider show tl ] ] HTH Brett.

 [16/16] from: agem:crosswinds at: 9-Jul-2001 15:59


RE: [REBOL] Re: updating text-list [brett--codeconscious--com] wrote:
> Hi Thorsten, > It appears that one needs to update the slider. Here's one way to go that
<<quoted lines omitted: 15>>
> ] > ]
extended that a bit, now it checks for size-change in show. volkers-styles: stylize [ volkers-text-list: text-list with [ "add size-change scrolling" last-shown-lines: -1 update-slider: does [ sld/redrag lc / max 1 length? head lines ] append init [ sub-area/feel/redraw: has[l] [ l: length? data if l <> last-shown-lines [ last-shown-lines: l update-slider ] ] ] ] ]
> HTH > Brett. >
-Volker

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted