Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rebol [title: "Parts"]
- write/append %data.txt ""
- database: load %data.txt
- clear-values: func [] [
- foreach fc gui/pane [
- if any [
- fc/style = 'field
- fc/style = 'area
- ][
- clear-face fc
- ]
- ]
- ]
- view center-face gui: layout [
- text "Parts in Stock:"
- name-list: text-list blue 400x100 data sort (extract database 4) [
- if none? value [return]
- marker: index? find database value
- set-face n pick database marker
- set-face a pick database (marker + 1)
- set-face p pick database (marker + 2)
- set-face o pick database (marker + 3)
- show gui
- ]
- text "Part Name:" n: field 400
- text "Manufacturer:" a: field 400
- text "SKU:" p: field 400
- text "Notes:" o: area 400x100
- across
- btn "Save" [
- if empty? n/text [alert "You must enter a Part name." return]
- if find (extract database 4) n/text [
- either true = request "Overwrite existing record?" [
- remove/part (find database n/text) 4
- ] [
- return
- ]
- ]
- save %data.txt repend database copy [n/text a/text p/text o/text]
- name-list/data: copy/deep sort (extract database 4)
- show name-list
- ]
- btn "Delete" [
- if true = request rejoin ["Delete " n/text "?"] [
- remove/part (find database n/text) 4
- save %data.txt database
- do-face clear-button
- name-list/data: copy/deep sort (extract database 4)
- show name-list
- ]
- ]
- clear-button: btn "New" [
- clear-values
- show gui
- ]
- ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement