Calendar: Difference between revisions

15,479 bytes removed ,  6 years ago
Line 4,755:
<lang ring>
# Project : Calendar
# Date : 2018/06/0305
# Author : Gal Zsolt (~ CalmoSoft ~)
# Email : <calmosoft@gmail.com>
Line 4,766:
win1 = new qwidget() {
 
day = list(12)
pos = newlist(12,37)
month = list(12)
week = list(7)
weekday = list(7)
button = newlist(7,6)
monthsnames = list(12)
week = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
months = ["January", "February", "March", "April", "May", "June", "July",
"August", "September", "October", "November", "December"]
days daysnew = [[5,1], [6,2], 0[7,3], [1,4], [2,5], [3,6], [4,7]]
daysnew mo = [[64,2]0, [70,3], [1,4], [2,5], [1,3,6], [2,4,7]0, [5,1]2]
mo mon = [431,028,031,330,531,130,331,631,230,431,030,231]
m2 = (((1969-1900)%7) + floor((1969 - 1900)/4) % 7) % 7
mon = [31,28,31,30,31,30,31,31,30,31,30,31]
for n = 1 to 12
m2 = (((1969-1900)%7) + floor((1969 - 1900)/4) % 7) % 7
month[n] = (mo[n] + m2) % 7
for n = 1 to 12
month[n] x = (momonth[n] + m21) % 7 + 1
x = (month[n] + 1) % 7 + for m = 1 to len(daysnew)
for m = 1 to len( if daysnew)[m][1] = x
if daysnew[m][1] nr = xm
nr = m ok
ok next
day[n] = daysnew[nr][2]
next
day[n] = daysnew[nr][2] next
for m = 1 to 12
next
for n = 1 to day[m] - 1
 
pos[m][n] = " "
for m = 1 to 12
for n = 1 to day[m] - 1 next
pos[m][n] = " " next
for m = 1 to 12
next
for n = day[m] to 37
next
if n < (mon[m] + day[m])
 
pos[m][n] = n - day[m] + 1
for m = 1 to 12
for n = day[m] to 37 else
if n < (mon[m] + day pos[m])[n] = " "
pos[m][n] = n - day[m] + 1 ok
else next
pos[m][n] = " "next
ok
next
next
 
setwindowtitle("Calendar")
setgeometry(100,100,650,800)
Line 4,814 ⟶ 4,810:
settext("")
}
 
year = new qpushbutton(win1)
{
Line 4,820 ⟶ 4,815:
year.settext("1969")
}
for n = 1 to 4
nr = (n-1)*3+1
showmonths(nr)
next
for n = 1 to 12
showweeks(n)
next
for n = 1 to 12
showdays(n)
next
show()
}
exec()
}
 
func showmonths(m)
monthsnames[1] = new qpushbutton(win1)
for n = m to m + {2
monthsnames[n] = new qpushbutton(win1)
setgeometry(120,40,60,20)
monthsnames[1].settext(months[1]){
if n%3 = }1
col = 120
rownr = floor(n/3)
if rownr = 0
rownr = n/3
ok
if n = 1
row = 40
else
row = 40+rownr*180
ok
else
colnr = n%3
if colnr = 0
colnr = 3
ok
rownr = floor(n/3)
if n%3 = 0
rownr = floor(n/3)-1
ok
col = 120 + (colnr-1)*160
row = 40 + rownr*180
ok
setgeometry(col,row,60,20)
monthsnames[n].settext(months[n])
}
next
 
func showweeks(n)
monthsnames[2] = new qpushbutton(win1)
for m = 1 to {7
col = m%7
setgeometry(280,40,60,20)
if col = 0 col = 7 monthsnames[2].settext(months[2])ok
weekday[m] = new }qpushbutton(win1)
{
colnr = n % 3
if colnr = 0
colnr = 3
ok
rownr = floor(n/3)
if n%3 = 0
rownr = floor(n/3)-1
ok
colbegin = 60 + (colnr-1)*160
rowbegin = 60 + (rownr)*180
setgeometry(colbegin+col*20,rowbegin,20,20)
weekday[m].settext(week[m])
}
next
 
func showdays(ind)
monthsnames[3] = new qpushbutton(win1)
if ind >=1 and ind <= {3
rowbegin = 60
setgeometry(440,40,60,20)
ok
monthsnames[3].settext(months[3])
if ind >=4 and ind <= }6
for nrowbegin = 1 to 7240
col = n%7ok
if colind >=7 0and colind <= 7 ok9
weekday[n]rowbegin = new qpushbutton(win1)420
ok
{
if ind >=10 and ind <= 12
setgeometry(60+col*20,60,20,20)
rowbegin = 600
weekday[n].settext(week[n])
ok
}
for m = 1 to next6
for n = 1 to 7
 
for ncol = 1 to n%7
if col = 0 col = n%7 ok
if colrow = 0 col = 7 okm
weekdaybutton[n][m] = new qpushbutton(win1)
{
if ind%3 = setgeometry(220+col*20,60,20,20)1
colbegin = weekday[n].settext(week[n])60
elseif ind%3 = }2
next colbegin = 220
else
 
for n = 1 to 7 colbegin = 380
col = n%7 ok
if col = 0 col = 7 ok setgeometry(colbegin+col*20,rowbegin+row*20,20,20)
weekday[n] = new qpushbutton nr = (win1m-1)*7+n
if nr <= {37
if pos[ind][nr] != " setgeometry(380+col*20,60,20,20)"
weekdaybutton[n][m].settext(weekstring(pos[nind][nr]))
}ok
next ok
}
 
for n = 1 to 7next
for m = 1 to 6next
col = n%7
if col = 0 col = 7 ok
row = m
button[n][m] = new qpushbutton(win1)
{
setgeometry(60+col*20,60+row*20,20,20)
nr = (m-1)*7+n
if nr <= 37
if pos[1][nr] != " "
button[n][m].settext(string(pos[1][nr]))
ok
ok
}
next
next
 
for n = 1 to 7
for m = 1 to 6
col = n%7
if col = 0 col = 7 ok
row = m
button[n][m] = new qpushbutton(win1)
{
setgeometry(220+col*20,60+row*20,20,20)
nr = (m-1)*7+n
if nr <= 37
if pos[2][nr] != " "
button[n][m].settext(string(pos[2][nr]))
ok
ok
}
next
next
 
for n = 1 to 7
for m = 1 to 6
col = n%7
if col = 0 col = 7 ok
row = m
button[n][m] = new qpushbutton(win1)
{
setgeometry(380+col*20,60+row*20,20,20)
nr = (m-1)*7+n
if nr <= 37
if pos[3][nr] != " "
button[n][m].settext(string(pos[3][nr]))
ok
ok
}
next
next
 
monthsnames[4] = new qpushbutton(win1)
{
setgeometry(120,220,60,20)
monthsnames[4].settext(months[4])
}
 
monthsnames[5] = new qpushbutton(win1)
{
setgeometry(280,220,60,20)
monthsnames[5].settext(months[5])
}
 
monthsnames[6] = new qpushbutton(win1)
{
setgeometry(440,220,60,20)
monthsnames[6].settext(months[6])
}
for n = 1 to 7
col = n%7
if col = 0 col = 7 ok
weekday[n] = new qpushbutton(win1)
{
setgeometry(60+col*20,240,20,20)
weekday[n].settext(week[n])
}
next
 
for n = 1 to 7
col = n%7
if col = 0 col = 7 ok
weekday[n] = new qpushbutton(win1)
{
setgeometry(220+col*20,240,20,20)
weekday[n].settext(week[n])
}
next
 
for n = 1 to 7
col = n%7
if col = 0 col = 7 ok
weekday[n] = new qpushbutton(win1)
{
setgeometry(380+col*20,240,20,20)
weekday[n].settext(week[n])
}
next
 
for n = 1 to 7
for m = 1 to 6
col = n%7
if col = 0 col = 7 ok
row = m
button[n][m] = new qpushbutton(win1)
{
setgeometry(60+col*20,240+row*20,20,20)
nr = (m-1)*7+n
if nr <= 37
if pos[4][nr] != " "
button[n][m].settext(string(pos[4][nr]))
ok
ok
}
next
next
 
for n = 1 to 7
for m = 1 to 6
col = n%7
if col = 0 col = 7 ok
row = m
button[n][m] = new qpushbutton(win1)
{
setgeometry(220+col*20,240+row*20,20,20)
nr = (m-1)*7+n
if nr <= 37
if pos[5][nr] != " "
button[n][m].settext(string(pos[5][nr]))
ok
ok
}
next
next
 
for n = 1 to 7
for m = 1 to 6
col = n%7
if col = 0 col = 7 ok
row = m
button[n][m] = new qpushbutton(win1)
{
setgeometry(380+col*20,240+row*20,20,20)
nr = (m-1)*7+n
if nr <= 37
if pos[6][nr] != " "
button[n][m].settext(string(pos[6][nr]))
ok
ok
}
next
next
 
monthsnames[7] = new qpushbutton(win1)
{
setgeometry(120,400,60,20)
monthsnames[7].settext(months[7])
}
 
monthsnames[8] = new qpushbutton(win1)
{
setgeometry(280,400,60,20)
monthsnames[8].settext(months[8])
}
 
monthsnames[9] = new qpushbutton(win1)
{
setgeometry(440,400,60,20)
monthsnames[9].settext(months[9])
}
for n = 1 to 7
col = n%7
if col = 0 col = 7 ok
weekday[n] = new qpushbutton(win1)
{
setgeometry(60+col*20,420,20,20)
weekday[n].settext(week[n])
}
next
 
for n = 1 to 7
col = n%7
if col = 0 col = 7 ok
weekday[n] = new qpushbutton(win1)
{
setgeometry(220+col*20,420,20,20)
weekday[n].settext(week[n])
}
next
 
for n = 1 to 7
col = n%7
if col = 0 col = 7 ok
weekday[n] = new qpushbutton(win1)
{
setgeometry(380+col*20,420,20,20)
weekday[n].settext(week[n])
}
next
 
for n = 1 to 7
for m = 1 to 6
col = n%7
if col = 0 col = 7 ok
row = m
button[n][m] = new qpushbutton(win1)
{
setgeometry(60+col*20,420+row*20,20,20)
nr = (m-1)*7+n
if nr <= 37
if pos[7][nr] != " "
button[n][m].settext(string(pos[7][nr]))
ok
ok
}
next
next
 
for n = 1 to 7
for m = 1 to 6
col = n%7
if col = 0 col = 7 ok
row = m
button[n][m] = new qpushbutton(win1)
{
setgeometry(220+col*20,420+row*20,20,20)
nr = (m-1)*7+n
if nr <= 37
if pos[8][nr] != " "
button[n][m].settext(string(pos[8][nr]))
ok
ok
}
next
next
 
for n = 1 to 7
for m = 1 to 6
col = n%7
if col = 0 col = 7 ok
row = m
button[n][m] = new qpushbutton(win1)
{
setgeometry(380+col*20,420+row*20,20,20)
nr = (m-1)*7+n
if nr <= 37
if pos[9][nr] != " "
button[n][m].settext(string(pos[9][nr]))
ok
ok
}
next
next
 
 
monthsnames[10] = new qpushbutton(win1)
{
setgeometry(120,580,60,20)
monthsnames[10].settext(months[10])
}
 
monthsnames[11] = new qpushbutton(win1)
{
setgeometry(280,580,60,20)
monthsnames[11].settext(months[11])
}
 
monthsnames[12] = new qpushbutton(win1)
{
setgeometry(440,580,60,20)
monthsnames[12].settext(months[12])
}
for n = 1 to 7
col = n%7
if col = 0 col = 7 ok
weekday[n] = new qpushbutton(win1)
{
setgeometry(60+col*20,600,20,20)
weekday[n].settext(week[n])
}
next
 
for n = 1 to 7
col = n%7
if col = 0 col = 7 ok
weekday[n] = new qpushbutton(win1)
{
setgeometry(220+col*20,600,20,20)
weekday[n].settext(week[n])
}
next
 
for n = 1 to 7
col = n%7
if col = 0 col = 7 ok
weekday[n] = new qpushbutton(win1)
{
setgeometry(380+col*20,600,20,20)
weekday[n].settext(week[n])
}
next
 
for n = 1 to 7
for m = 1 to 6
col = n%7
if col = 0 col = 7 ok
row = m
button[n][m] = new qpushbutton(win1)
{
setgeometry(60+col*20,600+row*20,20,20)
nr = (m-1)*7+n
if nr <= 37
if pos[10][nr] != " "
button[n][m].settext(string(pos[10][nr]))
ok
ok
}
next
next
 
for n = 1 to 7
for m = 1 to 6
col = n%7
if col = 0 col = 7 ok
row = m
button[n][m] = new qpushbutton(win1)
{
setgeometry(220+col*20,600+row*20,20,20)
nr = (m-1)*7+n
if nr <= 37
if pos[11][nr] != " "
button[n][m].settext(string(pos[11][nr]))
ok
ok
}
next
next
 
for n = 1 to 7
for m = 1 to 6
col = n%7
if col = 0 col = 7 ok
row = m
button[n][m] = new qpushbutton(win1)
{
setgeometry(380+col*20,600+row*20,20,20)
nr = (m-1)*7+n
if nr <= 37
if pos[12][nr] != " "
button[n][m].settext(string(pos[12][nr]))
ok
ok
}
next
next
 
show()
}
exec()
}
</lang>
Output image:
2,468

edits