Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I want it to work so bad....
#24
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?

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



[Image: image.png]

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.  Smile

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.  Smile
Reply


Messages In This Thread
I want it to work so bad.... - by NasaCow - 11-23-2022, 12:01 PM
RE: I want it to work so bad.... - by BSpinoza - 11-23-2022, 02:25 PM
RE: I want it to work so bad.... - by bplus - 11-23-2022, 02:59 PM
RE: I want it to work so bad.... - by bplus - 11-23-2022, 03:41 PM
RE: I want it to work so bad.... - by bplus - 11-23-2022, 05:04 PM
RE: I want it to work so bad.... - by NasaCow - 11-24-2022, 12:57 AM
RE: I want it to work so bad.... - by NasaCow - 11-25-2022, 06:16 AM
RE: I want it to work so bad.... - by bplus - 11-25-2022, 02:32 PM
RE: I want it to work so bad.... - by bplus - 11-26-2022, 03:14 AM
RE: I want it to work so bad.... - by mnrvovrfc - 11-26-2022, 07:42 PM
RE: I want it to work so bad.... - by bplus - 11-26-2022, 04:50 PM
RE: I want it to work so bad.... - by Pete - 11-26-2022, 05:37 PM
RE: I want it to work so bad.... - by JRace - 11-26-2022, 06:42 PM
RE: I want it to work so bad.... - by Pete - 11-26-2022, 06:54 PM
RE: I want it to work so bad.... - by bplus - 11-26-2022, 06:55 PM
RE: I want it to work so bad.... - by Pete - 11-26-2022, 07:11 PM
RE: I want it to work so bad.... - by bplus - 11-26-2022, 07:29 PM
RE: I want it to work so bad.... - by SMcNeill - 11-26-2022, 07:44 PM
RE: I want it to work so bad.... - by mnrvovrfc - 11-26-2022, 07:45 PM
RE: I want it to work so bad.... - by SMcNeill - 11-26-2022, 07:47 PM
RE: I want it to work so bad.... - by NasaCow - 11-27-2022, 11:46 AM
RE: I want it to work so bad.... - by Pete - 11-26-2022, 11:26 PM
RE: I want it to work so bad.... - by bplus - 11-27-2022, 05:47 AM
RE: I want it to work so bad.... - by mnrvovrfc - 11-27-2022, 06:12 AM
RE: I want it to work so bad.... - by Pete - 11-27-2022, 06:16 AM
RE: I want it to work so bad.... - by mnrvovrfc - 11-27-2022, 06:27 AM
RE: I want it to work so bad.... - by bplus - 11-27-2022, 06:47 AM
RE: I want it to work so bad.... - by bplus - 11-27-2022, 03:14 PM
RE: I want it to work so bad.... - by bplus - 11-27-2022, 08:22 PM
RE: I want it to work so bad.... - by mnrvovrfc - 11-28-2022, 03:19 AM
RE: I want it to work so bad.... - by bplus - 11-28-2022, 02:25 PM
RE: I want it to work so bad.... - by bplus - 11-30-2022, 08:46 PM
RE: I want it to work so bad.... - by justsomeguy - 11-30-2022, 09:31 PM
RE: I want it to work so bad.... - by bplus - 11-30-2022, 10:30 PM



Users browsing this thread: 7 Guest(s)