![]() |
Forum Index : Microcontroller and PC projects : GUI screen pack pure MMBasic
![]() ![]() ![]() ![]() |
|||||
Author | Message | ||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2139 |
nice. self-configuring. I love it |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2139 |
OK, I think I got it - and you are right, it greatly improves clarity - Thanks! ![]() the dot can still be any colour but it only shows when selected Edited 2021-03-24 17:44 by CaptainBoing |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2139 |
A good tweak, but fair warning - I plan to put support for different fonts in at some point. Having fixed Font H&W at the start will likely defeat this... i.e. FONTWIDTH & Co need to figure in the calculations at the point of use as they may change. your views? |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10064 |
This is great code - thanks for posting and as Jim has pointed out is very useful on the CMM2 as well as the other MMbasic variants. If you change mm.fontwidth to a function call e.g. get.mm.fontwidth then the code could be completely general and with a few mm.device$ conditionals could fully support the CMM2 as well. This would be really appreciated. |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2139 |
Thanks Peter - praise indeed! I like the idea of a function call mimicking the font sysvars on the MM |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6219 |
Here you are: FUNCTION fontheight() AS INTEGER IF cmm2 THEN fontheight = MM.INFO(fontheight) ELSE fontheight = MM.FONTHEIGHT ENDIF END FUNCTION FUNCTION fontwidth() AS INTEGER IF cmm2 THEN fontwidth = MM.INFO(fontwidth) ELSE fontwidth = MM.FONTWIDTH ENDIF END FUNCTION Jim VK7JH MMedit |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2139 |
Hello all. I have included Jim's modifications in the code. It works straight away on my F407. If anyone else fancies lifting and shifting the code from the wiki, trying it out and reporting back, please do. This version doesn't include any new functionality beyond the self-config and platform independence... later. |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2139 |
The slider gadget is now working. Menus are next. EDIT: Slider is working if you have the bottom limit at zero (e.g. 0-5).. there are issues for above (e.g. 3-5)... I'll sort it but not today ![]() Edited 2021-03-29 03:06 by CaptainBoing |
||||
elk1984![]() Senior Member ![]() Joined: 11/07/2020 Location: United KingdomPosts: 228 |
This is looking epic. I started looking at something similar, then (sigh) too much to try and not enough time. Nice work. |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9483 |
Fantastic. Keep up the good work, Captain! ![]() ![]() Watching this thread with interest. EDIT: Oh, BTW Captain - very nice article you have written on fruit of the shed. ![]() Edited 2021-03-29 15:45 by Grogster Smoke makes things work. When the smoke gets out, it stops! |
||||
RetroJoe![]() Senior Member ![]() Joined: 06/08/2020 Location: CanadaPosts: 290 |
@elk1984, yes, I had exactly the same sequence of thoughts when I first wired up my CMM2 mouse. @CaptwinBoing, very nice work! Even more incentive to get my F4 working :) @TassyJim, thanks very much for the CMM2 tweaks - this is now at the top of my "stuff to play with" list! Edited 2021-03-30 02:03 by RetroJoe Enjoy Every Sandwich / Joe P. |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2139 |
if you ignore the little bug with the slider (by not having zero as the bottom limit), I consider this pack is largely ready for an initial release as it contains pretty much all the usual stuff needed for a fairly decent GUI. What remains is Font support, two types of menu, a tab strip and pop-up windows. These are fairly "exotic" or at least not majorly used (maybe fonts). Hence I spent a while tweaking the code to get it compact, usable and standardized the function names so people can actually start using it if they want. Further releases will come but I am very conscious of the size creeping up which might make using it on the smaller 'mites a non-starter - it is still around 10K (without the demo prog in the wiki) and so I am hoping won't get in the way too much. This can be mitigated further by "library-izing" it to compact it right down. I haven't done this yet so I don't know how much will be saved but I do indent my code fairly heavily, so roughly 500 lines * 2 tabs average means it should shave off a K. Anyone who wants to use it, I would say go ahead as I will endeavor to make further releases backward compatible. can't see anything atm that would break your program. i.e. I won't be renaming the key function calls. If anyone notices some typos etc in the wiki article etc, be a sweetie and chip in to correct them. Ta. Many thanks to those who have already added code, method and critique, this is a real community effort, so don't be shy. More to come, but I am working on this only when I get a couple of hours run up so the remaining bits may not come for a month or two. enjoy. Edited 2021-03-30 07:33 by CaptainBoing |
||||
mclout999 Guru ![]() Joined: 05/07/2020 Location: United StatesPosts: 482 |
For one hot minute, We had GUI functions built-in but then it was removed. Why exactly was that done. Does anyone remember that we got that in a beta and then it was gone the next Beta aways back? I was just getting into those functions and they were removed. If this is a good idea why not in the firmware. Just wondering. |
||||
lizby Guru ![]() Joined: 17/05/2016 Location: United StatesPosts: 3309 |
This was Geoff's gui implementation for the MM+ and other higher-powered Micromites. Matherp tried them in the CMM2 saying they were provisional and then decided they were antithetical to the spirit of the CMM2. CaptainBoing's implementation was (as I understand it) originally intended to provide gui functionality for the original Micromite, the 28-pin MM2, for which Geoff's version, with numeric and alphanumeric virtual keypads built in, was too heavy-weight. But the Captain made his version work for all the Micromites, including the F4. TassyJim (& matherp) showed how to easily port this to the CMM2, and that has now been done. Bringing back the other version to the CMM2 would not solve the Captain's problem with lack of gui function on the MM2. (But I don't know of any reason why Geoff's version could not be put back into the CMM2 firmware.) PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
mclout999 Guru ![]() Joined: 05/07/2020 Location: United StatesPosts: 482 |
I was liking it when I had it and now that a mouse is so easy to add it seems like a good idea. |
||||
yock1960 Senior Member ![]() Joined: 18/08/2020 Location: United StatesPosts: 167 |
This is nice and has some good potential! I've been playing around with it on my CMM2....with a few hiccups. In sub GetTouch, the GUI Cursor Mouse statement needs uncommented....that one had me scratching my head a bit. After getting past that...oh...maybe add to the documentation that option mouse needs enabled for CMM2 users...I normally leave this off, since it's a bother to have to type 'mouse controller close' every time a program exits ungracefully. This also took me a few minutes to fathom. Now for some nit picks...minor ones. As copied, the slider pointer is not redrawn after being moved, I fixed this by adding: GUIObjDraw 71 inside the main loop. Not graceful...but it works. Also, the check/unchecked area for checkboxes doesn't seem to scale correctly to the frame around it...minor cosmetic issue. I haven't played with this...since I don't understand the usage of GUI Bitmap currently. What I have been doing the last few days, is to make the objects relocatable...since on the CMM2, one can have alot of screen 'real estate' and to add a window sub to make these non-destructive 'popups'. I'm in the early stages of working out a way to have multiple 'popups' on screen simultaneously. The first step is adding a third dimension to the O() variable. Next, I need to think of a way to track window 'focus' and what objects belong to what window. The 'window' really should be added as an object....baby steps! Steve GUI_demo_3.zip |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2139 |
Thanks for the feedback Steve. I have un-remmed the GUI CURSOR MOUSE in the CMM2 switch inside GetTouch - thanks. Not having a CMM2, that bit was done for me and I was putting it in "blind" You are right about the box on the checkboxes - that was corrected in V0.63 The slider object is re-drawn as it is moved in the "cursor/touch down" section of ProcessTouch() - Case 4 immediately before the Loop at the end of the case (line 181 in my code here) - there should be no reason to redraw in your own program. I am testing on an F4 and it animates nicely, so if there is some difference in action on the CMM2, see if you can catch it and fix in ProcessTouch() I am really pleased to see you playing and extending the functionality - precisely what this is meant for. Cheers Edited 2021-04-06 03:57 by CaptainBoing |
||||
yock1960 Senior Member ![]() Joined: 18/08/2020 Location: United StatesPosts: 167 |
Okay, when was v0.63, all I see is page history by number/date. This could be another CMM2 specific issue...although one of TassyJim's images appears to show it fixed. I think the slider redraw issue may be CMM2 related....how the mouse cursor is implemented...making this change (hiding the cursor while the slider is being moved) fixes it. Case 4'slider Local w --> GUI Cursor Hide <-- Do . . . Loop --> GUI Cursor Show <-- Steve |
||||
yock1960 Senior Member ![]() Joined: 18/08/2020 Location: United StatesPosts: 167 |
I just discovered what was apparently changed in the Checkbox draw routine. The GUI_bitmap statements were x+2,y+2, but are now x,y. If I put it back to x+2,y+2 the checkboxes are perfect on my CMM2. Steve |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2139 |
Thanks Steve. I have updated the code to provide your cursor controls inside the slider touch processor. Can't see that the checkbox needs any tweaking? Could you grab a closeup on the CMM2? F4 LCD Panel: ![]() |
||||
![]() ![]() ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |