Jay Shrimplin's Simple Text Calendar dressed up!
Mar 16, 2019 22:39:38 GMT -5
BeeTrap and Rod like this
Post by James Grubbs (Jimmy) on Mar 16, 2019 22:39:38 GMT -5
'Royalty Free Calendar Created By James Grubbs With Much
'Help From Simple Text Calendar Example Courtesy Jay Shrimplin
dim selday$(32)
nomainwin
WindowWidth = 295
WindowHeight = 255
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)
graphicbox #ecr.graphicbox1, 5, 5, 279, 217
stylebits #ecr, 0, _WS_MINIMIZEBOX, 0, 0
open "Royalty Free Calander" for graphics_nsb_nf as #ecr
print #ecr.graphicbox1, "when mouseMove [position]"
print #ecr.graphicbox1, "when leftButtonDown [clicked]"
print #ecr, "trapclose [quit.ecr]"
aDate$= date$("mm/dd/yyyy")
[viewcalendar]
print #ecr.graphicbox1, "cls"
print #ecr.graphicbox1, "down; fill 200 204 148; flush"
print #ecr, "down;fill 200 204 148; flush"
print #ecr.graphicbox1, "color blue; backcolor 200 204 148"
print #ecr.graphicbox1, "font arial 6_bold"
print #ecr, "font arial 10"
print #ecr.graphicbox1, "place ";25;" "; 20
print #ecr.graphicbox1, "\<"
print #ecr.graphicbox1, "place ";240;" "; 20
print #ecr.graphicbox1, "\>"
print #ecr.graphicbox1, "color black"
bdate$=monthname$(aDate$)+" "+right$(aDate$,4)
print #ecr.graphicbox1, "stringwidth? bdate$ bdatewidth"
bdate=int(140-(bdatewidth/2))
print #ecr.graphicbox1, "place ";bdate;" "; 20
print #ecr.graphicbox1, "\"; bdate$
FirstDay=date$(word$(aDate$,1,"/")+"/1/"+word$(aDate$,3,"/"))
LastDay$=date$(date$(word$(date$(FirstDay+32),1,"/")+"/1/"+word$(date$(FirstDay+32),3,"/"))-1)
dow=val(word$("3 4 5 x 6 7 x 1 2",int((FirstDay/7-int(FirstDay/7))*10)+1))
print #ecr.graphicbox1, "place 15 45"
print #ecr.graphicbox1, "\Sun Mon Tue Wed Thu Fri Sat"
for i=1 to val(mid$(LastDay$,4,2))
y=int((i+dow-2)/7)
x=(i+dow-2)-y*7
x=4*x+2
y=y+3
v=x*9: w=y*25
selday$(i)=str$(v)+" "+str$(w)
print #ecr.graphicbox1, "place ";v;" ";w
print #ecr.graphicbox1, "color blue"
cdate$=word$(date$(),2)
if i=val(cdate$) and aDate$=date$("mm/dd/yyyy") then print #ecr.graphicbox1, "color white"
print #ecr.graphicbox1, "\";using("###",i)
if aDate$<>date$("mm/dd/yyyy") then print #ecr.graphicbox1, "color white"
if aDate$<>date$("mm/dd/yyyy") then print #ecr.graphicbox1, "place ";205;" "; 200
if aDate$<>date$("mm/dd/yyyy") then print #ecr.graphicbox1, "\Current"
next i
print #ecr.graphicbox1, "flush"
wait
[position]
i=0
if MouseX<3 or MouseX>274 or MouseY<3 or MouseY>205 then cursor NORMAL: wait
if MouseX>17 and MouseX<42 and MouseY>7 and MouseY<27 then cursor NORMAL: wait
if MouseX>222 and MouseX<257 and MouseY>7 and MouseY<27 then cursor NORMAL: wait
if aDate$<>date$("mm/dd/yyyy") and MouseX>202 and MouseX<255 and MouseY>187 and MouseY<207 then cursor NORMAL: wait
cursor TEXT
if seldayx+22>MouseX and seldayx+1<MouseX and seldayy+1>MouseY and seldayy-15<MouseY then cursor NORMAL
[ploop]
scan
i=i+1
if i > val(mid$(LastDay$,4,2)) then wait
seldayx$=word$(selday$(i), 1)
seldayy$=word$(selday$(i), 2)
seldayx=val(seldayx$)
seldayy=val(seldayy$)
if seldayx+22>MouseX and seldayx+1<MouseX and seldayy+1>MouseY and seldayy-15<MouseY then cursor NORMAL: wait
goto [ploop]
[clicked]
if MouseX>17 and MouseX<42 and MouseY>7 and MouseY<27 then cursor NORMAL: goto [dateback]
if MouseX>222 and MouseX<257 and MouseY>7 and MouseY<27 then cursor NORMAL: goto [dateforward]
if aDate$<>date$("mm/dd/yyyy") and MouseX>202 and MouseX<255 and MouseY>187 and MouseY<207 then aDate$=date$("mm/dd/yyyy"): goto [viewcalendar]
if i > val(mid$(LastDay$,4,2)) or i < 1 then wait
exactdate$=left$(word$(bdate$,1),3)+" "+str$(i)+", "+word$(bdate$,2)
notice exactdate$ '<-------------------------------------------------------------output of selected day of month
wait
[dateback]
if left$(aDate$, 2)="01" then year$=right$(aDate$, 4): year=val(year$): year$=str$(year-1)
if left$(aDate$, 2)="01" then day$=mid$(aDate$, 3, 4): aDate$="12"+day$+year$: goto [viewcalendar]
dayyear$=right$(aDate$,8): month$=left$(aDate$, 2): month=val(month$): month$=str$(month-1)
if len(month$)<2 then month$="0"+month$
aDate$=month$+dayyear$
goto [viewcalendar]
[dateforward]
if left$(aDate$, 2)="12" then year$=right$(aDate$, 4): year=val(year$): year$=str$(year+1)
if left$(aDate$, 2)="12" then day$=mid$(aDate$, 3, 4): aDate$="01"+day$+year$: goto [viewcalendar]
dayyear$=right$(aDate$,8): month$=left$(aDate$, 2): month=val(month$): month$=str$(month+1)
if len(month$)<2 then month$="0"+month$
aDate$=month$+dayyear$
goto [viewcalendar]
[quit.ecr]
cursor NORMAL
close #ecr
notice "Royalty Free Calendar"+chr$(13)+"Feel free to use this calendar"+chr$(13)+"royalty free but at least"+chr$(13)_
+"give Jay Shrimplin credit in the"+chr$(13)+"about section of your software!"
end
function monthname$(aDate$)
month=val(aDate$)
monthname$=word$("January Febuary March April May June July August September October November December",month)
end function