Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Quest for a TUI Library
Page 1 of 2 | |||||
Author | Message | ||||
gevik Newbie Joined: 04/07/2020 Location: NetherlandsPosts: 10 |
In my quest for creating a TUI library for CMM2. I have started by hacking a simple screen using MMBasic to explore the screen, BLIT, and font capabilities. It looks like visually we can have a TUI library :) But before I can start developing such framework I need to explore the following areas among other things: [1] Is is possible to move and hold the cursor to a given location on screen? [2] Is is possible to type (write) with a cursor having a for/background color? [3] Is it in MMBasic possible to pass a Function/SUB as an argument for another Function/SUB, then being able to execute that argument within the parent Function/SUB? [4] Possibility for having virtual pages, so we can have the functionality to open and close (multiple) windows. [5] Possibility to write the basic TUI routines in a CSUB I am open for ideas. |
||||
elk1984 Senior Member Joined: 11/07/2020 Location: United KingdomPosts: 227 |
I'm sure you've seen already, but in case you haven't there's some parallel TUI chat here: https://www.thebackshed.com/forum/ViewTopic.php?FID=16&TID=9851 |
||||
mclout999 Guru Joined: 05/07/2020 Location: United StatesPosts: 430 |
(Do the URL link twice and it works. That is past click then past again and click.) https://www.thebackshed.com/forum/ViewTopic.php?FID=16&TID=9851 |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 2989 |
[1] Recently posted (for character position x & y): PRINT@( (MM.INFO(FONTWIDTH)*x%),(MM.INFO(FONTHEIGHT)*y%) )""; [2] If the cursor is, for instance, a blinking underline ("_"), then yes. [3]: like this? ? fun1(fun2(),7),fun1(fun3(),9) function fun1(i%,j%) as integer fun1=i%*j% end function function fun2() as integer fun2=11 end function function fun3() as integer fun3=13 end function In MMBasic DOS, output is " 77 117" [4] Not sure what is meant. Multiple windows should be possible. [5] Don't know why not. Or in MMBasic. ~ Edited 2020-09-22 09:43 by lizby PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8517 |
3. yes - but only on the CMM2: pass the function name as a string and then use the EVALUATE (FUNCTION) or EXECUTE (SUB) commands in the receiving function. You will have to build up any parameter list as part of the string before executing EVALUATE or EXECUTE Edited 2020-09-22 17:39 by matherp |
||||
gevik Newbie Joined: 04/07/2020 Location: NetherlandsPosts: 10 |
Thank you. This could serve as a callback handler for button and list like components |
||||
elk1984 Senior Member Joined: 11/07/2020 Location: United KingdomPosts: 227 |
Hi, how are you modelling the data structures (dare I say "classes" ) to describe the elements in the TUI? (Apologies if this is off topic) |
||||
gevik Newbie Joined: 04/07/2020 Location: NetherlandsPosts: 10 |
Hi, how are you modelling the data structures (dare I say "classes" ) to describe the elements in the TUI? (Apologies if this is off topic) I am still experimenting with that part. We don't have anything that could resemble a class. I am thinking about defining the UI objects with some kind of a data structure. Since we don't have a C like "typedef struct", I think I have to make use of Arrays. We also don't have event emitting and event handling mechanisms, which makes things even more challenging. A long time ago in Win16 API days (and not so long ago in Cocoa Objective-C days) we had an application loop which you used to handle all kinds of UI events. Perhaps a similar concept could work here. I am still experimenting :) |
||||
elk1984 Senior Member Joined: 11/07/2020 Location: United KingdomPosts: 227 |
Hi, how are you modelling the data structures (dare I say "classes" ) to describe the elements in the TUI? (Apologies if this is off topic) I am still experimenting with that part. We don't have anything that could resemble a class. I am thinking about defining the UI objects with some kind of a data structure. Since we don't have a C like "typedef struct", I think I have to make use of Arrays. We also don't have event emitting and event handling mechanisms, which makes things even more challenging. A long time ago in Win16 API days (and not so long ago in Cocoa Objective-C days) we had an application loop which you used to handle all kinds of UI events. Perhaps a similar concept could work here. I am still experimenting :) I've been pondering a similar problem for other apps. A control loop is fine (I handle all my key presses in a sub to keep the main loop clean), but I've drawn a blank with any kind of structured type. I'll start another thread now to keep this one on topic... |
||||
gevik Newbie Joined: 04/07/2020 Location: NetherlandsPosts: 10 |
Hi, how are you modelling the data structures (dare I say "classes" ) to describe the elements in the TUI? (Apologies if this is off topic) I am still experimenting with that part. We don't have anything that could resemble a class. I am thinking about defining the UI objects with some kind of a data structure. Since we don't have a C like "typedef struct", I think I have to make use of Arrays. We also don't have event emitting and event handling mechanisms, which makes things even more challenging. A long time ago in Win16 API days (and not so long ago in Cocoa Objective-C days) we had an application loop which you used to handle all kinds of UI events. Perhaps a similar concept could work here. I am still experimenting :) I've been pondering a similar problem for other apps. A control loop is fine (I handle all my key presses in a sub to keep the main loop clean), but I've drawn a blank with any kind of structured type. I'll start another thread now to keep this one on topic... I just found this thread: https://www.thebackshed.com/forum/ViewTopic.php?TID=12813&PID=155458#155458 |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 2989 |
Any further progress along this avenue? PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
gevik Newbie Joined: 04/07/2020 Location: NetherlandsPosts: 10 |
Any further progress along this avenue? At the moment I am experimenting to find a usable library design because of MMBasic's limitations for arrays and (non existing) object map functions. I am aiming for an API that is usables. |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 2989 |
Care to elaborate? PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
CircuitGizmos Guru Joined: 08/09/2011 Location: United StatesPosts: 1421 |
In my random thoughts while away from my PC, I envisioned a TUI that is a combination of the old VB for DOS mixed with a system I used with Python. I think some limitations can be overcome, but since this BASIC isn't event-driven there would need to be a template for the event loop that the programmer would follow. Micromites and Maximites! - Beginning Maximite |
||||
Barbiani Newbie Joined: 18/10/2020 Location: BrazilPosts: 6 |
Can this help? Maybe compiled as cfunction. |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3641 |
It outputs VT100 (or similar) Escape codes so how would it? John |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 2989 |
It outputs VT100 (or similar) Escape codes so how would it? John My thought is that it would make little sense on the CMM2 to write debugging text to the terminal, so the way to do it would be to output VT100 codes to a PC running Teraterm or puTTY or some other VT100 emulator. But it still depends on there being hooks in MMBasic. Same is true for other MMBasic implementions--debugging code might best be sent via serial to another device. PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
Barbiani Newbie Joined: 18/10/2020 Location: BrazilPosts: 6 |
Replacing its output functions with mmbasic calls. The built in editor can do both uart and vga. Vgaconio could do the same? |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 2989 |
Something like this: Using flip's framework from here: https://www.thebackshed.com/forum/ViewTopic.php?TID=9851 ~ Edited 2020-11-06 05:49 by lizby PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3641 |
It outputs VT100 (or similar) Escape codes so how would it? John My thought is that it would make little sense on the CMM2 to write debugging text to the terminal, so the way to do it would be to output VT100 codes to a PC running Teraterm or puTTY or some other VT100 emulator. But it still depends on there being hooks in MMBasic. Same is true for other MMBasic implementions--debugging code might best be sent via serial to another device. Oh, OK, but that doesn't seem to fit with the reason stated in the original post for this thread. Doing it the way you mentioned doesn't need anything but some MMBasic code, as some have already done, I think. John |
||||
Page 1 of 2 |
Print this page |