Thank you for all explications. I never thanked that what this way to do it.
So, I put your code in my project and it work as expected and fine. About gb.ncurses, when I say the terminal become unusable I mean that the Carrier Return does not work after closing my program, so press on the enter key does not create to a new line and the prompt is written on the same line, at the location where is the cursor. Cordialement, — Olivier Cruilles Email: olivier.cruil...@yahoo.fr Le October 1, 2015 à 12:23:06, Tobias Boege (tabo...@gmail.com) a écrit: On Thu, 01 Oct 2015, Yahoo wrote: > 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. > If you use gb.ncurses, you must do all terminal I/O using gb.ncurses or else you may mess up its internal state. That means instead of Input or Read you have to use Window.Read(). The way gb.ncurses initialises the ncurses library (the normal way) creates a clean new window, the standard screen, and you can't get rid of that. Therefore gb.ncurses is useful only for projects which want a full-featured TUI and would hence clean the screen anyway. Indeed there are at least three better options if you just want to tempora- rily disable echoing of input characters: (1) Use the "stty" program as shown in the attached project, (2) Use the termios.h functions from the C library via Extern (super ugly), or (3) Use gb.termios which is a component I have written for demonstration purposes and is not in the official source tree. Incidentally it brings the termios structures from point (2) to Gambas. You can find its sources here[0]. The test project available there does exactly hidden password input. > 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. > What terminal becomes unusable? And what does "unusable" mean? If you started the project from within the IDE and checked the "Use a terminal emulator" option, it is normal that the terminal won't respond after the process died (a possible interpretation of "unusable"). Once the Gambas process exits, there is no process left to use the terminal (no shell is started by the IDE to host the Gambas process), but the window is not destroyed. It just won't respond, so that you can read the last words of your process. This behaviour is explicitly enforced by the IDE. If this is not your case, then be more specific and send a project that reproduces the problem. Regards, Tobi [0] http://www-e.uni-magdeburg.de/tboege/gambas -- "There's an old saying: Don't change anything... ever!" -- Mr. Monk ------------------------------------------------------------------------------ _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user ------------------------------------------------------------------------------ _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user