
-----------------------------------
appling
Wed Feb 11, 2004 4:47 pm

make a calendar?
-----------------------------------
how could i make a well-formatted calendar? i only draw the box just like this


setscreen ("graphics:600;500")
locate (4, 3)
put "Sunday"
locate (4, 14)
put "Monday"
locate (4, 24)
put "Tuesday"
locate (4, 34)
put "Wednesday"
locate (4, 45)
put "Thursday"
locate (4, 56)
put "Friday"
locate (4, 66)
put "Saturday"


for i : 1 .. 6
    drawline (1, maxy div 7 * i, maxx, maxy div 7 * i, black)
    drawline (maxx div 7 * i, 1, maxx div 7 * i, maxy div 11 * 10, black)
end for
drawline (1, maxy div 11 * 10, maxx, maxy div 11 * 10, black)

but how to put the date in the box? :?:  :?:

-----------------------------------
Paul
Wed Feb 11, 2004 4:51 pm


-----------------------------------
Draw.Text seems the simplest way to me. I'd just store dates in arrays, and run a for loop, and every time adding on the coordinates.

-----------------------------------
appling
Wed Feb 11, 2004 4:55 pm


-----------------------------------
can u give me a simple example>?
how to make it turn to nest row or column?

-----------------------------------
Cervantes
Wed Feb 11, 2004 4:59 pm


-----------------------------------
drawbox (50, 50, 100, 100, black)
var font : int := Font.New ("serif:12")
Draw.Text ("5", 85, 85, font, black)

that's the syntax of Draw.Text... you can get that from the help file... :roll:

you should use for statements a lot for this project.

-----------------------------------
Paul
Wed Feb 11, 2004 5:01 pm


-----------------------------------
something like this:

var font := Font.New ("serif:24")
var x, y:int:=50
var dates: array 1..30 of int
for a: 1..30
dates(a):=a
end for
y:=325
for a: 1..30
Font.Draw (intstr(dates(a)), x, y, font, black)
x:=x+50
if a mod 7 = 0 then
y-=30
x:=50
end if
end for

you could do without the array here, but I only put it here so you can see, if you want to mess with it. You can mess with the coordinate increase rate to change the distances from each other.

-----------------------------------
appling
Wed Feb 11, 2004 5:08 pm


-----------------------------------
thanks a lot, i got it

-----------------------------------
appling
Wed Feb 11, 2004 8:37 pm


-----------------------------------
sorry, there's one thing i still do not understand.
how could i make it if the first day of the month is not beginning with monday, just like thursday or others? :(

-----------------------------------
Delos
Wed Feb 11, 2004 9:10 pm


-----------------------------------
Well, you know the x and y part of the Font.Draw.

Just play around with that.

My suggestion:

Consider the entire screen (or whatever part of it you are using) to be a grid...then use the x and y values to "locate" the point at which you need to put the number.
Play around a bit...you'll see.

-----------------------------------
appling
Wed Feb 11, 2004 9:41 pm


-----------------------------------
i am not sure how to do that. this is my code


setscreen ("graphics:600;540")

var font := Font.New ("serif:15")
var month, firstday : string
var dayofmonth, start, tof : int
var x, y : int := 50

put "PLEASE ENTER A MONTH:"
get month
put "THE FIRST OF THE MONTH IS WHAT DAY?"
get firstday

tof := 1
case month of
    label "february", "February", "2" :
        dayofmonth := 28
    label "january", "January", "1", "march", "March", "3", "may", "May", "5",
            "july", "July", "7", "august", "August", "8", "octaber", "Octaber",
            "10", "December", "12" :
        dayofmonth := 31
    label "april", "April", "4", "june", "June", "6", "september", "September",
            "9", "november", "November", "11" :
        dayofmonth := 30
    label :
        tof := 0
end case

case firstday of
    label "Sunday", "sunday" :
        start := 1
    label "Monday", "monday" :
        start := 2
    label "Tuesday", "tuesday" :
        start := 3
    label "Wednesday", "wednesday" :
        start := 4
    label "Thursday", "thursday" :
        start := 5
    label "Friday", "friday" :
        start := 6
    label "Saturday", "saturday" :
        start := 7
    label :
        tof := 0
end case

cls

var dates : array 1 .. dayofmonth of int
for a : 1 .. dayofmonth
    dates (a) := a
end for
y := 450
for a : 1 .. dayofmonth
    Font.Draw (intstr (dates (a)), x, y, font, black)
    x := x + 85
    if a mod 7= 0 then 
        y -= 80
        x := 50
    end if
end for

locate (4, 3)
put "Sunday"
locate (4, 14)
put "Monday"
locate (4, 24)
put "Tuesday"
locate (4, 34)
put "Wednesday"
locate (4, 45)
put "Thursday"
locate (4, 56)
put "Friday"
locate (4, 66)
put "Saturday"

for i : 1 .. 4
    drawline (1, 77 * i, maxx, 77 * i, black)
end for
drawline (1, 390, maxx, 390, black)
drawline (1, 470, maxx, 470, black)
drawline (1, 500, maxx, 500, black)

for k : 1 .. 6
    drawline (round (maxx div 7 * k), 1, round (maxx div 7 * k), maxy - 40, black)
end for



if tof = 0 then
    cls
    put "are u joking??"
end if


-----------------------------------
Paul
Wed Feb 11, 2004 9:51 pm


-----------------------------------
k thats good, but when I enter monday, it starts with sunday.
Edit: oh I see..., I think you can change the starting init value of the variable that determines the position of the text according to the days.
