fork download
  1. REBOL [title: "Parts"]
  2. write/append %data.txt ""
  3. database: load %data.txt
  4. view center-face gui: layout [
  5. text "Parts in Stock:"
  6. name-list: text-list blue 400x100 data sort (extract database 4) [
  7. if value = none [return]
  8. marker: index? find database value
  9. n/text: pick database marker
  10. a/text: pick database (marker + 1)
  11. p/text: pick database (marker + 2)
  12. o/text: pick database (marker + 3)
  13. show gui
  14. ]
  15. text "Part Name:" n: field 400
  16. text "Manufacturer:" a: field 400
  17. text "SKU:" p: field 400
  18. text "Notes:" o: area 400x100
  19. across
  20. btn "Save" [
  21. if n/text = "" [alert "You must enter a Part name." return]
  22. if find (extract database 4) n/text [
  23. either true = request "Overwrite existing record?" [
  24. remove/part (find database n/text) 4
  25. ] [
  26. return
  27. ]
  28. ]
  29. save %data.txt repend database [n/text a/text p/text o/text]
  30. name-list/data: sort (extract copy database 4)
  31. show name-list
  32. ]
  33. btn "Delete" [
  34. if true = request rejoin ["Delete " n/text "?"] [
  35. remove/part (find database n/text) 4
  36. save %data.txt database
  37. do-face clear-button 1
  38. name-list/data: sort (extract copy database 4)
  39. show name-list
  40. ]
  41. ]
  42. clear-button: btn "New" [
  43. n/text: copy ""
  44. a/text: copy ""
  45. p/text: copy ""
  46. o/text: copy ""
  47. show gui
  48. ]
  49. ]
  50.  
Runtime error #stdin #stdout #stderr 0.01s 7404KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
prog.rb:2: unknown type of %string
write/append %data.txt ""
                ^