Announcement

Collapse
No announcement yet.

Save entire screen for displaying later

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Save entire screen for displaying later

    There are a few cases where saving whatever is currently on the
    screen would be helpful, and do [whatever] adn then put the
    screen back the way it was. This is *not* correct, but will get
    the gist of what I hope to do.

    .program...
    if Dateok$ <> "Y" then
    PreserveScreen :' will save everything currestly displayed
    Print "Excuse me, the date you entered is out of range."
    Print "Use calendar to pick date."
    {user enters correct date at this point}
    RestoreScreen :' will make the screen the way it was
    end if
    ..program..

    Possible? The faster the method, the better, and I
    know I have seen a way to do this, probably in the forum.

    Thank you.

    Robert

    ------------------

  • #2
    Code:
    FUNCTION SaveScreen$ () PUBLIC
    
       DIM cell AS STRING PTR * 4000
       DIM stcell AS STRING PTR * 4000
       DIM Scr AS STRING
    
       Scr$ = SPACE$ (4000)
       cell = pbvScrnBuff
       stcell = STRPTR32 (Scr$)
       @stcell = @cell
       SaveScreen$ = Scr$
    
    END FUNCTION
    
    SUB RestoreScreen (Scr AS STRING) PUBLIC
    
       DIM cell AS STRING PTR * 4000
       DIM stcell AS STRING PTR * 4000
    
       IF LEN(Scr$) < 4000 THEN EXIT SUB
       cell = pbvScrnBuff
       stcell = STRPTR32 (Scr$)
       @cell = @stcell
    
    END SUB
    
    MyScreen$ = SaveScreen$
    ........
    ........
    RestoreScreen MyScreen$


    ------------------

    Comment


    • #3
      ...that being for text-mode screens of 80x25 characters.

      Graphics modes can be handled through the POINT function, though
      that will be slow. Faster methods would require low-level display
      programming. You can probably find examples in the Downloads.

      ------------------
      Tom Hanlin
      PowerBASIC Staff

      Comment


      • #4
        Hose-

        One inquiry please. Will the displayed routine maintain the
        colors of the background and text as well?

        Thank you.

        Robert

        ------------------

        Comment


        • #5
          Yes. It saves and restores characters and color attributes.


          ------------------

          Comment


          • #6
            Rem Save entire VGA Text Screen to VAR$

            def seg = &HB800
            Var$=peek$(0,4000)
            def seg


            Rem ReLoad previous saved VGA Text screen

            def seg = &HB800
            poke$ 0,Var$
            def seg


            I hope this helps a bit

            Gerhard


            ------------------

            Comment

            Working...
            X