GUI screen pack pure MMBasic


Author Message
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2171
Posted: 07:21am 23 Mar 2021      

Morning everyone.

Just wanted to share my current "spare time" project.

I have put WindowsCE/95-a-like GUIs in a lot of my projects on the smaller MicroMites that dominate my work. Larger 'mites (MM+, ARMMite etc.) have a GUI built into the firmware but size restriction on the Mk2 mean if you want a nice touch-screen display you have to build it yourself - and I have... from scratch, every time, resulting in rigid un-portable code.

I have had some interest from other users on how I did it and it seems to surprise everyone that MMBasic is quite capable of producing a responsive display on these smaller machines. Not a CSUB in sight - which is my aim because I want portability between the 'mite platforms.

So I have put together a more inclusive pack that you can simply insert in your code, a tiddly bit of config and start plopping your screen elements on the LCD panel and using them. It is about 10K at the moment - you can chop out the code for gadgets you won't be using easy enough, but I often had 6K of monolithic code for a far less capable GUI, so I don't consider it too much of a "waste". YMMV

For now, the main screen service routine is polled and returns the number of the object touched or -1 (nothing). It has proper handling of enablement, visibility, grouping of radio buttons etc. Please remember it is very much a work in progress and there are some bits missing but I think these are the not-used-as-much bits. I just wanted to get it out there for critique.

Note: I always poll for touches in the main loop of my code and the example code shows this. It wouldn't be a big task to do a touch interrupt handler with a wrapper to call the touch processor if that is your thing.

Main article (detailing how to use it with example) and code is here

Comments in the code are a bit thin but I will do a better job as releases occur.

Screen grab is a bit bleached out but you get the idea.



enjoy
Edited 2021-03-23 20:10 by CaptainBoing