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 - getrc() return the cursor row and column position http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 getrc()             Return the cursor row and column position
------------------------------------------------------------------------------
 Declaration
   screen.hdr

 Syntax
   func uint getrc extern

 Arguments
   None.

 Return
   A numeric value expressing the cursor position.

 Description
   This function returns the current cursor position (row and column)
   combined in one uint value, which later can be used to set the cursor
   position by calling the setrc() procedure.

   This pair of routines is handy if you need to save, and later restore
   a cursor position.

 Example
   #define EXAMPLE_SCREEN
   #include example.hdr

   proc Test_getrc
   vardef
     uint nRow, nCol
     uint nRowCol
   enddef
   
   // The conventional way to save/restore a cursor position
   clear
   nRow := row()                // save the current cursor position
   nCol := col()
   @ 10, 34 ?? "First method"   // some output stuff here
   @ nRow, nCol                 // restore the old cursor position
   getkey()
   
   // The shorter way to save/restore a cursor position
   clear
   nRowCol := getrc()           // save the current cursor position
   @ 10, 34 ?? "Second method"  // some output stuff here
   setrc( nRowCol )             // restore the old cursor position
   getkey()
   endproc

   proc main
   Test_getrc()
   endproc

See Also: restrc() saverc() setrc()

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