[Gambas-user] ncurses, question

Brian G brian at westwoodsvcs.com
Mon Jan 4 18:58:02 CET 2021

Thank you Tobias!

Very much appreciated 

Thank You
Brian G

----- Original Message -----
From: "Tobias Boege" <taboege at gmail.com>
To: "Gambas mailing list" <user at lists.gambas-basic.org>
Sent: Monday, January 4, 2021 4:22:59 PM
Subject: Re: [Gambas-user] ncurses, question

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 
> stuff 
> 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 
> a.endwin 
> 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

----[ http://gambaswiki.org/wiki/doc/netiquette ]----

More information about the User mailing list