[Gambas-user] ncurses, question
taboege at gmail.com
Mon Jan 4 17:22:59 CET 2021
On Sun, 03 Jan 2021, Brian G wrote:
> Hi Tobias,
> I see you authored the ncurses package, I have a question
> Is there some way with ncurses to issue the endwin within my program after I am done with a window and screen screen object.
> I see that the gb.ncurses main does an init and end..... but.....
> doing something like:
> dim a as new window
> a. def_prog_mode() ' save the mode
> a.endwin() ' restore the tty mode
> do stuff program on terminal
> a.refresh() ' to pop it back to ncurses mode
> stuff to do
I could have sworn that I implemented this long ago, but apparently not.
It is now done in df5022e3.
You get two new methods: Screen.Suspend, which does def_prog_mode() and
endwin(), and Screen.Resume, which does a doupdate(). All other calls to
refresh() or doupdate() from the gb.ncurses component are effectively
blocked until you do a Screen.Resume, so you don't accidentally return
to ncurses mode, e.g. due to Timers which redraw screen components
periodically in your application. Although the changes still happen to
the ncurses windows which are now tucked away somewhere in memory only.
All the changes done to your windows while you were suspended become
visible once you resume.
I do not want to give the Gambas programmer direct access to def_prog_mode()
and endwin(), because gb.ncurses does its own sort of buffering on top of
ncurses and needs to know what state it is in.
Attached is a demonstration.
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 11622 bytes
Desc: not available
More information about the User