11-27-2022, 06:27 AM (This post was last modified: 11-27-2022, 06:39 AM by mnrvovrfc.)
Earlier I was on Manjaro MATE testing this program before it was modified.
Now I'm on EndeavourOS, another Arch-based Linux distro, maybe I should have gone for a different family LOL. The program's progress is as slow as molasses. This is at my side, cannot get "get_filename" working like the first time (LOL because I had to rename "arial.ttf" to "Arial.ttf" -- LINUX IS A CASE-SENSITIVE OS), had to set "filename.txt" manually. The "change" button is really unresponsive only using the mouse. Must use [TAB], or I really don't know what I did to finally get the student's name displayed on the top field in order to be able to change his/her score.
OK just did it again: after loading the file and watching the list, selected "Coolman" with the mouse, pressed [ENTER] and then it did give me his name on the top field. Otherwise I don't get any name and no changes. Also could press [ENTER] while focused on "changes" button.
The "score" field could become a bit fiddly. After one name is entered and the cursor on the list moves to the next name, I could press [TAB] twice to return to the "score". But I type in a 2-digit number and it doesn't show it. I have to type something extra so it shows anything. This happens after the first successful input which changes a score in a column.
Maybe on Windows and/or a faster computer this would work well. Oh well but it's not really for me. Somebody in my family wanted me to be a teacher but I didn't have the greatest quality for it IMHO...
The get_NewFile can be compiled for Linux from the sub folder of that source code, if direntry.h doesn't work from same folder as source (and you compile exe to source folder) then try have the direntry,h file in with QB64pe.exe folder.
Selecting off a list control like files or folders or a student name, first have selection highlighted then Right Click the list box anywhere. Or as you mentioned highlight and press Enter, in get_Filename I even have a button below the folders to select and change directory when you have your choice highlighted.
I was getting strange response with mouse wheel, slow and jammed up anything else you wanted to do UNTIL it finished scrolling. So maybe avoid scrolling with wheel and PgUp/down, Home/End and arrow to choice??
I left these same comments in Class Notes.txt file with zip package.
Tip on coding in this GUI,
con(controlHandle).property
con() is array that holds the controls and just about everything has to be addressed to con().
I also added a tip under list box how to get the array index number of the selected item from that array in list box.
There is similar function that returns the actual string of the array.
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:
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.
:
Simple interface, simple interactions, no external libraries needed.
It might be too small for NasaCow to read. But we seek his/her opinion about it.
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
I like all that data you keep on students and idea of periodic reports to parents, never crossed my mind (specially when my main interest is whipping up a GUI demo! ).
I look forward to reviewing your zip package and thanks for feedback.
I do intend to replace my GUI get_Filename with new Dialog for that, should work better for Minerva in Linux, no SHELL which I worried most about for Linux folks, and replace my MBox and InputBox with new Message Box and Input Box and that should really lighten up my GUI code. My plans for today: A new update for GUI and your Gradebook app with new stuff.
Thanks for challenging idea and I've considered a popup menu thing maybe through an new InputBox depends on test length they allow.
11-27-2022, 08:22 PM (This post was last modified: 11-27-2022, 08:25 PM by bplus.)
OK that went fairly smoothly. I tossed out all my preDialog code including get_Filename, mBox and InputBox and greatly lightened the LOC load and removed that exe from zip along with sub directory source code in zip package. I did a very tiny function for returning the array index of highlighted item in a list box complementary to the returning the string.
I also right aligned the pathed files the Gradebook Editor is using and shrank the font so they might fit across the screen and if not you will at least see the tail end on the right side.
I hope @mnrvovrfc would please check this version out in Linux using the new _OpenFileDialog$() that replaced my get_Filename.exe. Hey no longer need to worry about that direntry.h file!
The screen shot is pretty much the same except for smaller right aligned pathed files the editor is using.
So I need only attach the much, much smaller zip 2.45 MB - 560.45 KB = ?
Onto updating all old GUI with new fit and trim vs GUI.BM file.
11-28-2022, 03:19 AM (This post was last modified: 11-28-2022, 03:27 AM by mnrvovrfc.)
The "DECLARE" in the BI file has to be commented out completely.
Otherwise it works a lot like the previous version. After the first entry is made and the cursor on the list moves down, pressing [ENTER] goes to the button on the top-left. Then I press [ENTER] or [TAB] twice because I don't want to change the score column, and the program doesn't show any cursor in the score field. When I start typing something in, it waits until I put four or five numerals in it before it displays them. Sometimes it doesn't care if I change the score column and then press [ENTER] or [TAB], the score field is insolent. It's the only flaw besides the whole program still being ponderous.
Almost forgot to say: I am not using a mouse with wheel, I only have a laptop with touchpad and two half-broken buttons. I dislike scrolling if not with an external mouse with a real wheel.
11-30-2022, 08:46 PM (This post was last modified: 11-30-2022, 08:49 PM by bplus.)
OK removed the remainder of direntry.h from vs GUI.BI hard to believe that causes problems maybe if it can't find the direntry.h file?
Anyway not needed so gone.
Then a little harder thing to track down that goofy problem with jumping to the text box for test scores, you start to type something but it does not show up?? It is confusing to explain but Enter while focus was on a button no longer automatically shifts focus off button after the button click event code is run. So you can move the next active control in code and it wont be undone when return execution from the Click event by way of Enter keypress. So now enter a score, focus to Change button, Enter there the change is made in Grades the next name is selected, the Test Col text box is skipped and focus is on Score text box again to enter next test score down the column.
Fixing the S L O W scrolling required major surgery removing fancy font code option and reverting back to good ole dependable _Font 16 guaranteed width and height for each char for nice pretty columns of data that don't need to go quite as far across the screen even without MonoType. Normal prompt scrolling is back!
There are enough changes to show an updated screen shot, I threw in a label for the Grades List box:
And zip with latest changes to vs GUI.Bi and BM for Gradebook Editor, might be a tad smaller than last zip?
No? more yak in the "Manual" .txt files: Class Notes.txt and b+ Very Simple Gui.txt