On Tue, 28 Jul 2009, Guy Roussin wrote:

Hi,

> Thank you i update harbour from svn and now it restores correctly default
> terminal color on exit. But only for the prompt and the cursor, the rest of 
> the
> screen is always black.
> How can i restore screen before harbour app ?

There is not method which allows to check default console color
so we cannot use it as default color in GTTRM. We have to chose
sth arbitrary. By default color 0x07 is used. There is also no
chance to check original terminal screen contents to save it
in the buffer and then restore. Few terminals have escape sequence
which allow to send screen context to application but it's very seldom
functionality so we cannot use it (AFAIR some old SCO terminals had
such feature).

> This sample give a black screen :
> #!/usr/bin/hbrun //GTTRM
> function main(cFiltre)
> local cScreen:=savescreen( 0,0,maxrow(),maxcol() )
> USE test
> dbedit()
> restscreen( 0,0,maxrow(),maxcol(), cScreen )
> return(NIL)

Yes it is and it's expected behavior. We cannot restore sth what we
do not know. Anyhow it's possible to make a trick and simulate such
behavior on some terminals which supports alternative screen display.

This code shows it. It works with terminals which supports the following
escape sequences:
   ESC [ ? 47 h   // switch to alternate screen
   ESC [ ? 47 l   // restore original screen


#!/usr/bin/hbrun //GTTRM
proc main()

   fwrite( 1, chr( 27 ) + "[?47h" )    // switch to alternate screen

   dispbox( 0, 0, maxrow(), maxcol(), "+-+|+-+| " )
   wait

   fwrite( 1, chr( 27 ) + "[?47l" )    // restore startup screen

return

best regards,
Przemek
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to