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?
Gambas command line TUI app
- BruceSteers
- Posts: 1581
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: Gambas command line TUI app
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
BruceS
-
- Posts: 363
- Joined: Wednesday 2nd December 2020 12:11am
- Location: Northampton, England
- Contact:
Re: Gambas command line TUI app
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?
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?
- Technopeasant
- Posts: 144
- Joined: Saturday 13th July 2019 6:50pm
- Location: Stony Plain, Alberta, Canada
- Contact:
Re: Gambas command line TUI app
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.
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.
- BruceSteers
- Posts: 1581
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: Gambas command line TUI app
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
BruceS
- Technopeasant
- Posts: 144
- Joined: Saturday 13th July 2019 6:50pm
- Location: Stony Plain, Alberta, Canada
- Contact:
Re: Gambas command line TUI app
Are you aware of any example code for gb.term.form or is it not even that complete?
- BruceSteers
- Posts: 1581
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: Gambas command line TUI app
not that works.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?
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
BruceS
- BruceSteers
- Posts: 1581
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: Gambas command line TUI app
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. :-/
# 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
BruceS
- Technopeasant
- Posts: 144
- Joined: Saturday 13th July 2019 6:50pm
- Location: Stony Plain, Alberta, Canada
- Contact:
Re: Gambas command line TUI app
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.