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

How_to_change_content_of_text-list

 [1/2] from: philb::upnaway::com at: 2-Feb-2003 21:19


Hi Yogi, You have to operate on the Block of words that you supply to the text-list. A Fix for oyour program is : REBOL[ Title: "listentest3" ] lv-data: ["Apfel" "Birne" "Pflaume"] view layout[ textliste: text-list data lv-data button "Liste 1" [ clear lv-data foreach lv-item ["eins" "zwei" "drei"] [append lv-data lv-item] show textliste ] button "Liste 2" [ append lv-data "vier" show textliste ] ] Cheers Phil === Original Message === Hello, I have written this test-code: REBOL[ Title: "listentest3" ] view layout[ textliste: text-list data ["Apfel" "Birne" "Pflaume"] button "Liste 1" [ textliste/data: ["eins" "zwei" "drei"] show textliste ] button "Liste 2" [ append textliste/data "vier" show textliste ] ] If I press directly after starting the programm on button Liste 2, the string "vier" is added to the text-list in the GUI. But if I press on the button Liste 1 nothing happens. If I press after that on button Liste 2, also nothing happens. This looks very strange to me. Is it possible to assign a new block as content to a text-list? Thanks for help. cu, yogi

 [2/2] from: gscottjones:mchsi at: 1-Feb-2003 7:34


Hi, Yogi, From: "Marc Michael"
> I have written this test-code: > REBOL[
<<quoted lines omitted: 16>>
> Liste 2, also nothing happens. This looks very strange to me. Is it > possible to assign a new block as content to a text-list?
You may find a few different points of view on this issue (I was surprised someone hasn't already written). Before I go further let me warn you that this functionality is **expected to change** in the future, so anything you do now may break in a year. That warning aside, your example demonstrates what many people have tried because it intuitively "seems" right. However what works is as follows. You need to use the /lines instead of the /data path, and when assigning a fresh data list you need to use COPY. There is one other inconsistency that I cannot seem to remember right now. Here is the code. REBOL[ Title: "listentest3" ] view layout[ textliste: text-list data ["Apfel" "Birne" "Pflaume"] button "Liste 1" [ textliste/lines: copy ["eins" "zwei" "drei"] show textliste ] button "Liste 2" [ append textliste/lines "vier" show textliste ] ] The next problem that you will run into is that the list slider does not automatically update after the list grows too long. Click the button a time or two in the following segement: view layout[ textliste: text-list data ["Apfel" "Birne" "Pflaume" "eins" "zwei" "drei" "vier"] button "Liste 1" [ append textliste/lines ["Apfel1" "Birne1" "Pflaume1" "eins1" "zwei1" "drei1" "vier1"] show textliste ] ] The slider length stays the same. :( The workaround is a function that has evolved over time. (The original may have been Sterling???). Currently, it very closely mimics what other code in /View uses. fix-slider: func [faces [object! block!]] [ foreach list to-block faces [ list/sld/redrag list/lc / max 1 length? head list/lines ] ] view layout[ textliste: text-list data ["Apfel" "Birne" "Pflaume" "eins" "zwei" "drei" "vier"] button "Liste 1" [ append textliste/lines ["Apfel1" "Birne1" "Pflaume1" "eins1" "zwei1" "drei1" "vier1"] fix-slider textliste show textliste ] ] This functionality also is expected to change with the next /View VID release. Hope this helps. --Scott Jones

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