Gambas command line TUI app
Posted
#1
(In Topic #1068)
Enthusiast

Does anyone have any examples of making an TUI app on the command line?
Also would a Gambas command line app run without xserver?
Posted
Guru

AndyGable said
Hi everyone,
Does anyone have any examples of making an TUI app on the command line?
Also would a Gambas command line app run without xserver?
what's a TUI app ?
yes it runs with no xserver but of course you cannot use gb.gui or any gui related components
Posted
Enthusiast

Am I still able to use the things like list boxes etc in the command app or do I need to use the Linux native methods?
Posted
Regular

https://forum.gambas.one/viewtopic.php?t=820
https://forum.gambas.one/viewtopic.php?p=7298
You do not get to use a form designer though, so will have to do it in markup.
Posted
Guru

AndyGable said
Sorry TUI stand for Text user interface
Am I still able to use the things like list boxes etc in the command app or do I need to use the Linux native methods?
nope. unless you're running a gui system like x11 or wayland.
a listbox is a graphical GUI object part of gb.gui and a Terminal does not work like that. a terminal only has text output
there are methods. like technopeasant says there is ncurses
there's also the unfinished gb.term.form component that was supposed to provide a gui like experience in a terminal.
Posted
Regular

Posted
Guru

Technopeasant said
Are you aware of any example code for gb.term.form or is it not even that complete?
not that works.
there some test classes in the component but they don't seem to function.
Maybe the source code can reveal some clues on how it works.
Looks to me like it was created some time ago and needs updating as the root classes like TermControl.class throw a lot of errors out.
I think if you can figure out how to get xterm escape sequences properly then it's just a case of monitoring mouse position and clicks.
here's info on all the escape sequences (the mouse tracking relevant ones)
https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
Posted
Guru

# enable mouse button tracking…
echo -e "\e[?7;1002h"
# enable SGR mode if you want more easily readable codes.
echo -e "\e[?7;1006h"
now mouse click some terminal area and see the data.
I'm not sure how to process the data. (gb.form.terminal probably has code that processes escape sequences though so maybe study that)
Should give you something to play with
EDIT:
I just realized i may have slid off track here still stuck thinking about mouse clicking GUI's
i guess a proper "TUI" would work on keypress events not mouse. :-/
Posted
Regular

1 guest and 0 members have just viewed this.


