QB64 Phoenix Edition
I want it to work so bad.... - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3)
+---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10)
+---- Thread: I want it to work so bad.... (/showthread.php?tid=1175)

Pages: 1 2 3 4


RE: I want it to work so bad.... - Pete - 11-26-2022

When I was 11 I had an I.Q. of 158. That's like saying at 11 I had the intellect of a 17 year old. Fast forward nearly 60 years, do the division, and that would make my present I.Q. around 45. So a grade of 54, I can certainly live with.

Pete


RE: I want it to work so bad.... - bplus - 11-26-2022

Well I just sketched out how I might do edits with GUI:
One button to load the Class.txt file from which we get the list of names and the name of the class to name the Gradebook.dat file and see if one exists. Load that or get the array started with a list of names = one List box for the whole array.

Use the list box for picking row=name of line to edit and then one Txt box to say which test column to edit 1 to 10.
Then of course the txt box for the score to edit to.
Another button to make the actual edit and maybe move the row down one for next name in same column so can do a whole batch of test scores in a single column with minimal key strokes eg loading next name in name label and clearing score or inserting score for that name to edit.

Grades List box
Load Class.txt button
Make Change button
Test Column text box
Grade score text box

Labels:
1 for Class.txt file
2 for Gradebook.dat file
3 for Test Col text box
4 for test Score text box
5 for row = name of selected line in grades list box
6 for actual name highlighted

11 controls no menu needed that I can see.

“Mann Tracht, Un Gott Lacht”


RE: I want it to work so bad.... - mnrvovrfc - 11-26-2022

(11-26-2022, 03:14 AM)bplus Wrote: So here is the package I made to prepare to convert to GUI but really, do we have to? It's working pretty nice already! Smile

Source code for get_Filename.exe is in sub folder for you to compile but I use SHELL to call it from inside demo bas files and I don't know if that works for Linux folks. You folks will have to plug in your own version of that line I think?
This must be a WIP. I don't understand what is done by the "main" program LOL, choose a column and then add up for each student?

On Manjaro MATE the GUI is sluggish, that is my only complaint. Otherwise it's the usual changing of filenames to all-lowercase and removal of spaces within to make sure it worked. Also copied the "arial.ttf" to the same directory as the program executables. But it's my tendency.

For "filename.txt" on Linux don't forget to write a full path in its style, not Windows style!

Almost forgot to mention that in "OpenWindow" sub in the BM file, might have to make the extra test to put "./" in front of a font filename candidate because using "_CWD$()" either isn't enough or confuses the command processor.


RE: I want it to work so bad.... - SMcNeill - 11-26-2022

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


RE: I want it to work so bad.... - mnrvovrfc - 11-26-2022

(11-26-2022, 07:44 PM)SMcNeill Wrote: 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.
:
Simple interface, simple interactions, no external libraries needed.  Smile
It might be too small for NasaCow to read. But we seek his/her opinion about it.


RE: I want it to work so bad.... - SMcNeill - 11-26-2022

(11-26-2022, 07:45 PM)mnrvovrfc Wrote:
(11-26-2022, 07:44 PM)SMcNeill Wrote: 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.
:
Simple interface, simple interactions, no external libraries needed.  Smile
It might be too small for NasaCow to read. But we seek his/her opinion about it.

If you're talking about the image, it's just a preview.  Click it to expand it.  Wink


RE: I want it to work so bad.... - Pete - 11-26-2022

Steve, is that a grade card or just 49 people who are really, really bad at golf?

Pete Big Grin


RE: I want it to work so bad.... - bplus - 11-27-2022

I had to WD-40 my own GUI chops getting this GUI Gradebook Editor worked out but its coming back to me.

Some strange actions with controls specially the mouse wheel on the Grades list box, it must be recalculating and redrawing the screen every move up or down? I did get it to easily go down a column of new test scores. If teacher arranges scores to record the same as listed in Class.txt file, should go smoothly entering results of Friday's Test.

Here's a shot of the GUI Gradebook Editor in action:
   

And the zip with an alternate PE Forum ABCs Class.txt file with 9 of us and only 2 test column completed.
Again the source for recreating Get_Filename.exe is in a sub folder.


RE: I want it to work so bad.... - mnrvovrfc - 11-27-2022

(11-27-2022, 05:47 AM)bplus Wrote: I had to WD-40 my own GUI chops getting this GUI Gradebook Editor worked out but its coming back to me.
Maybe it's just me but the "direntry.h" also has to be copied, along with "vs GUI" include files, in the same directory as "gradebook" program if the "gradebook" requires them...

Nice work otherwise, I wish I could get like you.


RE: I want it to work so bad.... - Pete - 11-27-2022

Not bad. I give it a b+

Pete Big Grin