[Gambas-user] How to input hide password into gambas command line project ?

Benoît Minisini gambas at ...1...
Thu Oct 1 17:47:44 CEST 2015


Le 01/10/2015 17:31, Yahoo a écrit :
> Hello all,
>
> Since few day I work on a little project that consist to a cli
> program written in Gambas3 where the first task is to ask to the user
> to enter a password but of course, all written character must be
> hidden.
>
> I try to use INPUT instruction but all characters entered are
> automatically written on the terminal so it’s not a good solution. I
> try to use gb.ncurses to do the same work and a strange thing
> happens. Just enabling gb.ncurses on the project without any
> instruction to create a new Window (as described in the gb.ncurses
> tutorial) and automatically all characters written in console to the
> INPUT instruction are hidden. This solution could work but I have
> other problem when for example I terminate the program, the terminal
> where the program is started become unusable. I don’t know why but in
> the end this solution is not usable in my case.
>
> Does someone could help me on this problem please ?
>
> PS:  Event Application_Signal(Signal As Integer) raise correctly when
> gb.ncurses is disabled in console based program (Gambas
> 3.8.90+svn7374+build31~ubuntu14.04.1 installed into Linux Mint 17.2)
> but does not raise when gb.ncurses is enabled, event if no
> instruction regarding this component is used in the program.
>
> Thank you
>
> Olivier Cruilles
>

This is a terminal thing, you must first learn how works a terminal 
under linux. Here is a few information:

gb.ncurses offers you some facilities to configure the terminal your 
application is (eventually) plugged in. Tobias may give you more details 
than me about that, he wrote the component.

Your application has a terminal if you run it from a terminal or a 
terminal emulator.

An application has a terminal too if it is run through the SHELL Gambas 
instruction.

An application can inherit the terminal of its parent application.

An application can have no terminal. For example when you set 
Application.Daemon to TRUE, or when its input/output are "redirected" to 
a file.

By default a terminal has echo "on", i.e. as soon as you hit a key, the 
character is both displayed and sent to the application.

gb.ncurses turns echo to "off" by default.

A serial port (from gb.net) and a terminal is almost the same thing.

Regards,

-- 
Benoît Minisini




More information about the User mailing list