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

Refresh LIST data

 [1/4] from: vado::fabrice::chello::fr at: 28-Oct-2002 11:13


Hi All, This is my first POST and I hope no one have posted-it (sorry for my english ;). I don't arrive to refresh the /data of a list. What's wrong with this code ? 8<-----8<-----8<-----8<-----8< forum: copy [ ["Elément 1" "Colonne 1"] ["Elément 2" "Colonne 2"] ["Elément 3" "Colonne 3"] ] view layout [ vh1 "Test LIST" below lstforum: list leaf 300x100 [ across text 100 text 100 ] data forum button brick "Change data" [ forum: [ ["Sujet 1" "Date 1"] ["Sujet 2" "Date 2"] ["Sujet 3" "Date 3"] ] lstforum/data: forum show lstforum ] button "Quit" [ unview ] ] 8<-----8<-----8<-----8<-----8< Thanks ! -- Fabrice

 [2/4] from: anton:lexicon at: 29-Oct-2002 0:42


Hi Fabrice, try these alternatives: 1) Find where the list stores the pointer to the data block: button brick "Change data" [ stuff: second second get in lstforum 'subfunc append clear stuff [ ["Sujet 1" "Date 1"] ["Sujet 2" "Date 2"] ["Sujet 3" Date 3 ] ] show lstforum ] 2) Use a supply function: forum: copy [ ["Elément 1" "Colonne 1"] ["Elément 2" "Colonne 2"] ["Elément 3" "Colonne 3"] ] view center-face layout [ below lstforum: list leaf 300x100 [ across txt1: text 100 txt2: text 100 ] data forum supply [ txt1/text: all [(row: pick head forum count) (pick row 1)] txt2/text: all [(row: pick head forum count) (pick row 2)] ] button brick "Change data" [ append clear forum [ ["Sujet 1" "Date 1"] ["Sujet 2" "Date 2"] ["Sujet 3" Date 3 ] ] show lstforum ] button "Close" [ unview ] ] Two important changes: 1) added a supply function, this allows the faces to be updated after the initial setting. 2) in "Change data", we are modifying the original block. By the way, don't expect to understand how this works very quickly. I still learned some things figuring this out today. Anton.

 [3/4] from: vado:fabrice:chello at: 28-Oct-2002 16:49


Hi Anton,
>Hi Fabrice, try these alternatives: >1) Find where the list stores the pointer to the data block: >... > stuff: second second get in lstforum 'subfunc >...
Wow ! I need some time to understand this part ;)
>2) Use a supply function: >... > txt1/text: all [(row: pick head forum count) (pick row 1)] > txt2/text: all [(row: pick head forum count) (pick row 2)] >...
A french user also give me this tip.
>2) in "Change data", we are modifying the original block.
Why ?!?
>By the way, don't expect to understand how this works >very quickly. I still learned some things figuring this >out today.
Ouf ! You reassure me. It will be necessary that I take part even more in this list then, but that goes quickly... too quickly ;). Thank you very much Anton, I will study your code. -- Fabrice Vado

 [4/4] from: anton:lexicon at: 30-Oct-2002 1:37


Fabrice,
> >2) in "Change data", we are modifying the original block. > > Why ?!?
If we write this code: forum: copy [ ["Elément 1" "Colonne 1"] ... ] this is what happens: 'forum -> [ ["Elément 1" "Colonne 1"] Now after we build the layout, and the list is built, this is the situation: 'forum -> [ ["Elément 1" "Colonne 1"] ... ] ^ | | second second get in lstforum 'subfunc If we reassign 'forum, this is the situation: 'forum -> [ ["Sujet 1" "Date 1"] ... ] [ ["Elément 1" "Colonne 1"] ... ] ^ | | second second get in lstforum 'subfunc The list knows nothing about the change ! The list keeps its own word 'stuff, which points to the original block, but unfortunately that word is kept deep inside the list. Anton.