Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - restrc() restore saved cursor position http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 restrc()            Restore saved cursor position
------------------------------------------------------------------------------
 Declaration
   screen.hdr

 Syntax
   proc restrc extern

 Arguments
   None.

 Return
   None.

 Description
   This procedure restores the current cursor position (row and column) from
   an internal buffer where it was saved by saverc(). This pair of
   routines is handy if you need to save, and later restore a cursor
   position.

   Force makes use of one internal buffer only, i.e. saverc()/restrc() calls
   cannot be nested. If you call saverc() several times and then
   restrc(), the cursor position which was saved last will be
   restored.

   If you call restrc() before a cursor position was saved by saverc(), the
   cursor will be positioned at 0, 0 (the top left corner of the
   screen).

 Example
   #define EXAMPLE_SCREEN
   #include example.hdr

   proc Test_restrc
   vardef
      uint nRow, nCol
   enddef
   
   // The conventional way to save/restore a cursor position
   //
   nRow := row()              // save the current cursor position
   nCol := col()
   ? "Some"                   // change cursor position by writing to screen
   ? "output"
   @ nRow, nCol               // restore the old cursor position
   getkey()
   
   // The shortest way to save/restore a cursor position
   //
   saverc()                   // save the current cursor position
   ? "Some"                   // change cursor position by writing to screen
   ? "output"
   restrc()                   // restore the old cursor position
   getkey()
   endproc

   proc main
   Test_restrc()
   endproc

See Also: col() getrc() restrc() row() saverc()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson