11-26-2022, 07:44 PM
Aren't you guys getting a little too fancy with all this? GUI library? Menu Library?
Isn't this, at its heart, basically just displaying and interacting with a table?
Now, I've got things cramped up in here (adding some more room for extra spaces wouldn't be a bad idea, but it's just a demo to illustrate the point...), but this shows 40 students and 21 grades on a single screen.
And best part? Drawing these isn't any more complicated that just a few simple line and print statements.
At this point, I don't bother to interact with the grid any, but that'd be easy enough to do as everything has a nice simple set formula for where it's displayed upon the screen.
Grade(0,0) is at position (xOffset, yOffset)-STEP(3*_FONTWIDTH, _FONTHEIGHT). Click the mouse within those coordinates and then trigger an EDIT event for grade(0,0)...
Grade(2,3) is at position (xOffset + 3 * _FONTWIDTH, yOffset + 2 * _FONTHEIGHT)-STEP(3*_FONTWIDTH, _FONTHEIGHT). Click the mouse within those coordinates and then trigger an EDIT event for grade(2,3)...
Simple grid with set coordinates which corresponds formulaically with the array that holds our data. Easy to create, easy to display, easy to interact with.
With a simple little menu up top to start a new gradebook, load an old one, or save the one you're currently working with.
It doesn't have to be fancy and track 7 classes of 40 students across 6 semesters for 13 years....
Just one simple class of students for one semester. After that, do like my teachers did in school -- simply get a fresh gradebook. I'd picture the hard drive to have a folder which basically just looked like:
Student Grades:
"Class 1 -- 1st Semester -- 2022.TXT"
"Class 1 -- 2nd Semester -- 2022.TXT"
"Class 1 -- 3rd Semester -- 2022.TXT"
.
.
.
And so on for Class 2, Class3, ClassX and for Semesters and Years as needed.
When the year ends, you just pull data from each of those files, average it out and weigh it as necessary, and then you have the yearly averages.
Simple interface, simple interactions, no external libraries needed.
Isn't this, at its heart, basically just displaying and interacting with a table?
Code: (Select All)
SCREEN _NEWIMAGE(1024, 720, 32)
$COLOR:32
DIM SHARED Students(40) AS STRING * 40 '40 characters for first and last name both.
DIM SHARED Grades(40, 20) AS _BYTE '41 students, 21 grades on page
FOR i = 0 TO 40
Students(i) = "Student #" + _TRIM$(STR$(i))
FOR j = 0 TO 20
Grades(i, j) = RND * 101
NEXT
NEXT
DO
CLS , 0
DrawBasicMenu
DrawNames
DrawGrades
_LIMIT 30
_DISPLAY
LOOP UNTIL _KEYHIT
SUB DrawBasicMenu
LINE (0, 0)-(_WIDTH - 1, _FONTHEIGHT), DarkGray, BF
LINE (0, 0)-(_WIDTH - 1, _FONTHEIGHT), Black, B
COLOR Black, 0
_PRINTSTRING (0, 0), " New Load Save"
COLOR White, 0
_PRINTSTRING (0, 0), " N L S "
END SUB
SUB DrawNames
LINE (0, _FONTHEIGHT)-STEP(40 * _FONTWIDTH, 42 * _FONTHEIGHT), DarkGray, B
LINE (0, (2 * _FONTHEIGHT))-STEP(40 * _FONTWIDTH, 41 * _FONTHEIGHT), DarkGray, BF
COLOR White, 0
pw = _PRINTWIDTH("Student Name")
_PRINTSTRING ((40 * _FONTWIDTH - pw) \ 2, _FONTHEIGHT + 1), "Student Name"
COLOR Black, 0
FOR i = 0 TO 40
_PRINTSTRING (0, (i + 2) * _FONTHEIGHT + 1), Students(i)
IF i MOD 2 THEN
LINE (0, _FONTHEIGHT * (i + 2))-STEP(40 * _FONTWIDTH, 0), LightGray, BF
ELSE
LINE (0, _FONTHEIGHT * (i + 2))-STEP(40 * _FONTWIDTH, 0), Gray, BF
END IF
NEXT
END SUB
SUB DrawGrades
xOffset = 40 * _FONTWIDTH + 1
yOffset = 2 * _FONTHEIGHT + 1
LINE (xOffset, yOffset)-STEP(63 * _FONTWIDTH, 41 * _FONTHEIGHT), DarkGray, BF
FOR i = 0 TO 40 'number of students
FOR j = 0 TO 20 'number of tests
COLOR Black, 0
_PRINTSTRING (xOffset + j * 3 * _FONTWIDTH + 1, yOffset + _FONTHEIGHT * i + 1), _TRIM$(STR$(Grades(i, j)))
IF i MOD 2 THEN
LINE (xOffset + j * 3 * _FONTWIDTH, yOffset + _FONTHEIGHT * i)-STEP(3 * _FONTWIDTH, 0), LightGray, BF
ELSE
LINE (xOffset + j * 3 * _FONTWIDTH, yOffset + _FONTHEIGHT * i)-STEP(3 * _FONTWIDTH, 0), Gray, BF
END IF
LINE (xOffset + j * 3 * _FONTWIDTH, yOffset)-STEP(3 * _FONTWIDTH, 41 * _FONTHEIGHT), Black, B
LINE (xOffset + j * 3 * _FONTWIDTH, yOffset)-STEP(0, -_FONTHEIGHT), DarkGray
NEXT
NEXT
END SUB
Now, I've got things cramped up in here (adding some more room for extra spaces wouldn't be a bad idea, but it's just a demo to illustrate the point...), but this shows 40 students and 21 grades on a single screen.
And best part? Drawing these isn't any more complicated that just a few simple line and print statements.
At this point, I don't bother to interact with the grid any, but that'd be easy enough to do as everything has a nice simple set formula for where it's displayed upon the screen.
Grade(0,0) is at position (xOffset, yOffset)-STEP(3*_FONTWIDTH, _FONTHEIGHT). Click the mouse within those coordinates and then trigger an EDIT event for grade(0,0)...
Grade(2,3) is at position (xOffset + 3 * _FONTWIDTH, yOffset + 2 * _FONTHEIGHT)-STEP(3*_FONTWIDTH, _FONTHEIGHT). Click the mouse within those coordinates and then trigger an EDIT event for grade(2,3)...
Simple grid with set coordinates which corresponds formulaically with the array that holds our data. Easy to create, easy to display, easy to interact with.
With a simple little menu up top to start a new gradebook, load an old one, or save the one you're currently working with.
It doesn't have to be fancy and track 7 classes of 40 students across 6 semesters for 13 years....
Just one simple class of students for one semester. After that, do like my teachers did in school -- simply get a fresh gradebook. I'd picture the hard drive to have a folder which basically just looked like:
Student Grades:
"Class 1 -- 1st Semester -- 2022.TXT"
"Class 1 -- 2nd Semester -- 2022.TXT"
"Class 1 -- 3rd Semester -- 2022.TXT"
.
.
.
And so on for Class 2, Class3, ClassX and for Semesters and Years as needed.
When the year ends, you just pull data from each of those files, average it out and weigh it as necessary, and then you have the yearly averages.
Simple interface, simple interactions, no external libraries needed.