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

[REBOL] Simple text-list modifications

From: atruter::hih::com::au at: 30-Aug-2002 16:52

The following script may be of use to those requiring a simple way of managing a text-list. Note that the (tab) method may not be appropriate for more complex data structures (especially if column widths vary greatly), but I have found this works well for key / value pairs where the key is a number / code or date of fairly consistent length. <code> REBOL [] change svv/vid-styles/text-list/init/75/4/6 'gold stylize/master [slider: scroller] record-list: copy [] repeat cnt 20 [insert record-list reform [cnt "^-" now/date]] modify-list: func [face /update-row row-to-update /add-row row-to-add] [ either update-row [ replace face/data face/picked/1 row-to-update ][ either add-row [ insert face/data row-to-add ][ remove find face/data face/picked/1 ] face/sld/data: 0 face/sn: 0 face/sld/redrag face/lc / max 1 length? head face/lines ] show face ] view layout [ lst: text-list data record-list as-is across btn "Update" [modify-list/update-row lst reform [random 100 "^-" now/time]] btn "Add" [modify-list/add-row lst reform [random 100 "^-" now/time]] btn "Delete" [modify-list lst] ] </code> Regards, Ashley *****************Privacy, Confidentiality & Liability Notice ************ This email is intended for the named recipient only. The information contained in this message may be confidential, or commercially sensitive. If you are not the intended recipient you must not reproduce or distribute any part of this email, disclose its contents to any other party, or take any action in reliance on it. If you have received this email in error, please contact the sender immediately. Please delete this message from your computer. You must scan this email and any attached files for viruses. The company accepts no liability for any loss, damage or consequence, whether caused by our own negligence or not, resulting directly or indirectly from the use of any attached files. Any views expressed in this Communication are those of the individual sender, except where the sender specifically states them to be the views of the Company. **************************************************************************