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 - saverc() save the current cursor position http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 saverc()            Save the current cursor position
------------------------------------------------------------------------------
 Declaration
   screen.hdr

 Syntax
   proc saverc extern

 Arguments
   None.

 Return
   None.

 Description
   This procedure saves the current cursor position (row and column) in an
   internal buffer for later use by restrc(). 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() calls
   cannot be nested. If you call saverc() several times and then
   restrc(), the cursor position which was saved last will be
   restored.

 Example
   #define EXAMPLE_SCREEN
   #include example.hdr

   proc Test_saverc
   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_saverc()
   endproc

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

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