Post by Γιώργος Κ
Thank you very much for this wonderful project!
I just installed it and giving it a try.
I have 2 questions, console programming related.
1) Is there any command Input-like, that allows for a specific number
of characters input (without pressing Enter)?
Eg. lets say, I'm presenting the user a Y or N question. What I
expect, is a single character input (with no need, for pressing
There is getch(). Try it and tell me if it's what you're looking for.
Post by Γιώργος Κ
2) Is there any way for coloring the text (eg. presenting a question
with red or green letters), other than messing with ncurses?
Something closer to BASIC tradition, maybe?
Ncurses is more or less complicated! :-)
Long time ago, I made something like that for a Linux terminal. Let's
look into Rolf's archive :-)
Ok, maybe this helps. Here is one module I made which is for some screen
functions. In a Linux terminal, you need Esc[ strings to handle this,
and these strings are produced here. What you do is calling the
functions and building the strings into the string you send to the
terminal. If you have more questions, no problem...
' Gambas module file
PRIVATE esc AS String = Chr$(27) & "["
PUBLIC CONST Black AS String = "0"
PUBLIC CONST Red AS String = "1"
PUBLIC CONST Green AS String = "2"
PUBLIC CONST Yellow AS String = "3"
PUBLIC CONST Blue AS String = "4"
PUBLIC CONST Magenta AS String = "5"
PUBLIC CONST Cyan AS String = "6"
PUBLIC CONST White AS String = "7"
PUBLIC CONST Foreground AS String = "3"
PUBLIC CONST Background AS String = "4"
PUBLIC FUNCTION Cls() AS String
RETURN esc & "2J" & esc & "H"
PUBLIC FUNCTION Normal() AS String
RETURN esc & "0m"
PUBLIC FUNCTION Bold() AS String
RETURN esc & "1m"
PUBLIC FUNCTION Gray() AS String
RETURN esc & "2m"
PUBLIC FUNCTION Underline() AS String
RETURN esc & "4m"
PUBLIC FUNCTION Blink() AS String
RETURN esc & "5m"
PUBLIC FUNCTION Reverse() AS String
RETURN esc & "7m"
PUBLIC FUNCTION MoveTo(row AS Integer, col AS Integer) AS String
IF row < 1 THEN row = 1
IF row > 25 THEN row = 25
IF col < 1 THEN col = 1
IF col > 80 THEN col = 80
RETURN esc & CStr(row) & ";" & CStr(col) & "f"
PUBLIC FUNCTION Color(FgBg AS String, Colorvalue AS String) AS String
RETURN esc & FgBg & Colorvalue & "m"