You build a grocery list by tap-selecting items from the master list, as in the first screenshot. You unselect a selected item by tapping it again. I used the master list items from Listful - all 245 of them! These are contained in the attached file "Groc1Clean.txt" which you need to download and place at the same location as the program. Each item selected in the master list will appear in the grocery list.
While shopping, tap items in the grocery list to select them as you add them to your cart. If you remove an item from the cart, tap it again in the grocery list to unselect it. When your shopping trip is over, you can see what items were not purchased, and perhaps add them to the next list.
Eventually I will add clear, new, add, edit, search, sort, load and save functions. There will also be export and import functions, so that lists can be easily transferred between Windows devices. I will also enhance the visual design of the program.
You are not limited to grocery lists. I currently have lists on Listful for shopping, to-do, camping and many other activities.
Code: Select all
''
ListMaker by rbytes
October 2017
''
#.scrclear(1,1,1)
' load a master list array of grocery items
> t, 1..245
c[t] = #.readline("Groc1Clean.txt")
<
temp3 = ""
sz = #.size(c,1)
' draw title
#.fontsize(30)
#.drawtext(555,50,"ListMaker")
#.fontsize(20)
' make listbox 1 for master list
a = #.listbox
a.height = 450
a.width = 300
a.x = 250
a.y = 200
a.source = c
#.drawrect(248,198,552,652)
' make listbox 2 for grocery list
b = #.listbox
b.height = 450
b.width = 300
b.x = 700
b.y = 200
#.drawrect(698,198,1002,652)
#.show(a,b)
' make list labels
#.drawtext(346,160,"Master List")
#.drawtext(750,160," Grocery Shopping")
' main program loop
>
? a.index > 0
temp3 = ""
in = a.index
a.index = 0
temp = c[in]
temp2 = #.mid(temp,1,1)
' toggle checkmark
? temp2 = " "
c[in] = "✓ " + #.mid(temp,4,#.size(temp))
!
c[in] = " " + #.mid(temp,2,#.size(temp))
.
a.source = c
> t, 1..sz
? #.mid(c[t],1,1) = "✓"
temp3 += " "+#.mid(c[t],2,50) + #.lf
.
<
d = #.split(temp3,#.lf)
b.source = d
.
? b.index > 0
temp4 = ""
in = b.index
b.index = 0
temp = d[in]
temp2 = #.mid(temp,1,1)
? temp2 = " "
d[in] = "✓ " + #.mid(temp,4,#.size(temp))
!
? temp2 != ""
d[in] = " " + #.mid(temp,2,#.size(temp))
.
.
b.source = d
.
#.relax()
<