Gambas command line TUI app

Post your Gambas programming questions here.
Post Reply
AndyGable
Posts: 363
Joined: Wednesday 2nd December 2020 12:11am
Location: Northampton, England
Contact:

Gambas command line TUI app

Post by AndyGable »

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?
User avatar
BruceSteers
Posts: 1580
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Gambas command line TUI app

Post by BruceSteers »

AndyGable wrote: Friday 14th July 2023 10:34pm 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
If at first you don't succeed , try doing something differently.
BruceS
AndyGable
Posts: 363
Joined: Wednesday 2nd December 2020 12:11am
Location: Northampton, England
Contact:

Re: Gambas command line TUI app

Post by AndyGable »

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?
User avatar
Technopeasant
Posts: 144
Joined: Saturday 13th July 2019 6:50pm
Location: Stony Plain, Alberta, Canada
Contact:

Re: Gambas command line TUI app

Post by Technopeasant »

ncurses is available. I just released a game using it.

viewtopic.php?t=820
viewtopic.php?p=7298

You do not get to use a form designer though, so will have to do it in markup.
Technical director,
Piga Software
http://icculus.org/piga/
User avatar
BruceSteers
Posts: 1580
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Gambas command line TUI app

Post by BruceSteers »

AndyGable wrote: Friday 14th July 2023 11:28pm 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.
If at first you don't succeed , try doing something differently.
BruceS
User avatar
Technopeasant
Posts: 144
Joined: Saturday 13th July 2019 6:50pm
Location: Stony Plain, Alberta, Canada
Contact:

Re: Gambas command line TUI app

Post by Technopeasant »

Are you aware of any example code for gb.term.form or is it not even that complete?
Technical director,
Piga Software
http://icculus.org/piga/
User avatar
BruceSteers
Posts: 1580
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Gambas command line TUI app

Post by BruceSteers »

Technopeasant wrote: Sunday 16th July 2023 4:06am 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/ctls ... e-Tracking
If at first you don't succeed , try doing something differently.
BruceS
User avatar
BruceSteers
Posts: 1580
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Gambas command line TUI app

Post by BruceSteers »

if you open a terminal you can type the following...

# 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. :-/
If at first you don't succeed , try doing something differently.
BruceS
User avatar
Technopeasant
Posts: 144
Joined: Saturday 13th July 2019 6:50pm
Location: Stony Plain, Alberta, Canada
Contact:

Re: Gambas command line TUI app

Post by Technopeasant »

As I understand it, mouse and keyboard are acceptable in a TUI, though probably best that it can all be done with only a keyboard if necessary.
Technical director,
Piga Software
http://icculus.org/piga/
Post Reply