I didn’t have anything better to do, so I thought I would expand on the calendar program I posted above. This version will allow you to input and save information for any day you select. Tap on a day and an input window will open. The keyboard will show so you can input data. Pressing RETURN will save the data and close the window. A white asterisk will show for that date so you know there’s data there. Selecting a date that has an asterisk will display the data that was saved without showing the keyboard. If you want to add data, tap the show keyboard button at the bottom of the calendar. The input window has a button to delete all the data for that date and one to close the window. The arrows at the top of the calendar allow you to select the previous or next month. The information is saved as local data, so the data is saved when the program is closed and restored when the program starts. I didn’t add any type of pop up reminder for the data.

```
supportedOrientations(LANDSCAPE_ANY)
displayMode(FULLSCREEN)
function setup()
dowTab={} -- day of week table
dataTab={} -- data table
showData=false
saveData=false
sel=vec2(0,0)
d=os.date("*t") --get current date
currMonth=d.month
currDay=d.day
currYear=d.year
year=currYear
month=currMonth
dName={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"}
days={31,28,31,30,31,30,31,31,30,31,30,31}
mName={"January","February","March","April","May","June",
"July","August","September","October","November","December"}
startMonth()
d=listLocalData() -- get saved data and build data table
for a,b in pairs(d) do
dataTab[b]=readLocalData(b)
end
end
function draw()
background(40, 40, 50)
stroke(255)
strokeWidth(2)
for z=1,8 do
line(120,z*100-30,960,z*100-30)
line(z*120,70,z*120,670)
end
dayName()
dayNumber()
monthName()
if showData then
dataWindow()
end
if saveData then
saveTable()
end
end
function keyboard(k)
if k==RETURN then
dataTab[tabStr]=dataTab[tabStr].."\
"
hideKeyboard()
showData=false
saveData=true
elseif k==BACKSPACE then
dataTab[tabStr]=string.sub(dataTab[tabStr],1,string.len(dataTab[tabStr])-1)
else
dataTab[tabStr]=dataTab[tabStr]..k
end
end
function saveTable()
saveData=false
clearLocalData() -- delete local data
for a,b in pairs(dataTab) do -- save data table information as local data
saveLocalData(a,b)
end
end
function dataWindow()
fill(0,0,0)
rect(240,370,600,370)
fontSize(17)
fill(255)
textMode(CORNER)
textWrapWidth(600)
line(240,680,840,680)
if dataTab[tabStr]~=nil then
text(dataTab[tabStr],250,390)
end
fontSize(25)
text("Show keyboard",450,30)
str=string.format("%d%d",sel.x,sel.y)
text(dowTab[str],400,700)
fill(255,0,0)
text("Delete",250,700)
fill(0,255,0)
text("Close",770,700)
end
function createTab() -- day of week, month, day, year
local d=dNbr
c=0
n=1
for y=6,1,-1 do
for x=1,7 do
c=c+1
str=string.format("%d%d",x,y)
dowTab[str]=""
if c>=dNbr and n<=days[month] then
str1=string.format("%s %s %d %d",dName[d],mName[month],n,year)
d=d+1
n=n+1
if d>7 then
d=1
end
dowTab[str]=str1
end
end
end
end
function monthName()
textMode(CENTER)
fontSize(35)
fill(0,255,0)
text(string.format("%s %d",mName[month],year),WIDTH/2,HEIGHT-40)
text("<---",150,730) -- previous month
text("--->",930,730) -- next month
end
function dayName()
fill(0,0,255)
textMode(CORNER)
fontSize(20)
for z=1,7 do
text(dName[z],z*120+10,670)
end
end
function dayNumber()
if year%4==0 then
days[2]=29 -- leap yesr
else
days[2]=28 -- not leap year
end
-- show day number in calendar. current date in green
c=0
n=1
for y=1,6 do
for x=1,7 do
c=c+1
if c>=dNbr and n<=days[month] then
if month==currMonth and n==currDay and year==currYear then
fill(0,255,0)
else
fill(255,0,0)
end
text(n,x*120+5,740-y*100)
n=n+1
end
end
end
-- check data table for info and show asterisk
fill(255)
fontSize(40)
for y=1,6 do
for x=1,7 do
str=string.format("%04d%02d%d%d",year,month,x,y)
if dataTab[str]~=nil and dataTab[str]~="" then
text("*",x*120+55,790-(8-y)*100)
end
end
end
end
function startMonth()
t=os.time{year=year,month=month,day=1}
d=os.date("*t",t)
dNbr=d.wday
createTab()
end
function touched(t)
if t.state==BEGAN then
if showData then
if t.x>775 and t.x<850 and t.y>700 and t.y<800 then -- close
showData=false
sel=vec2(0,0)
hideKeyboard()
end
if t.x>250 and t.x<350 and t.y>700 and t.y<800 then -- delete
dataTab[tabStr]=nil
showData=false
sel=vec2(0,0)
hideKeyboard()
saveData=true
end
if t.x>450 and t.x<600 and t.y>20 and t.y<60 then -- show keyboard
showKeyboard()
end
return
end
if t.x>80 and t.x<180 and t.y>700 and t.y<760 then -- show previous month
showData=false
sel=vec2(0,0)
month=month-1
if month<1 then
month=12
year=year-1
end
startMonth()
return
end
if t.x>875 and t.x<975 and t.y>700 and t.y<760 then -- show next month
month=month+1
if month>12 then
month=1
year=year+1
end
startMonth()
return
end
for x=1,7 do -- which day was touched
for y=1,6 do
if t.x>x*120 and t.x<x*120+120 and t.y>y*100-20 and t.y<y*100+80 then
str=string.format("%04d%02d%d%d",year,month,x,y)
tabStr=str
sel=vec2(x,y)
if dataTab[tabStr]==nil or dataTab[tabStr]=="" then
dataTab[tabStr]=""
showKeyboard()
end
showData=true
end
end
end
end
end
```