(11-25-2022, 02:32 PM)bplus Wrote: @NasaCow
I was thinking about what TempodiBasic wrote and realized last night it's a piece of cake to use a list box just like a menu!
Just read the item in the selectItem event and do what you would do for selecting a menu Item. I remember one time making a calculator solely from a list box control! Menus and buttons both can be done from a list box.
TempodiBasic also brought up an interesting thought, you do know how to write code for an event? I left a manual?
Anyway you are fighting city hall with two systems wanting control of mouse and keypress events.
Have you thought of building different GUI apps (.exes) and then jobbing out to them from a central menu app, that way you can have both systems and keep them separate for mouse control.
Update: now you've done it, I am trying a gradebook app with GUI ;-))
(11-26-2022, 07:44 PM)SMcNeill Wrote: 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
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.
(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.It might be too small for NasaCow to read. But we seek his/her opinion about it.
:
Simple interface, simple interactions, no external libraries needed.
BPLUS I look forward to seeing everything you throw as well! I am glad my Polish side can inspire others as well
I love it! It is a great layout for what I want on the gradebook side. I promise mine would have been a lot uglier than this. I am only a half-decent programmer on my best days I only saw this AFTER I posted my stuff on WIP forum.
And, yes, I am a him. Just teach little ones all day makes me sometimes a little more happy-go-lucky than your average guy