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 - restoreworkarea() restore the last saved work area http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 restoreworkarea()   Restore the last saved work area
------------------------------------------------------------------------------
 Declaration
   database.hdr

 Syntax
   proc restoreworkarea extern

 Arguments
   None.

 Return
   None.

 Description
   The restoreworkarea() procedure restores the last work area saved using
   saveworkarea(). The database at the time of the last saveworkarea()
   is the selected database. The record pointer of the selected database
   is neither saved nor restored with the work area.

   The saveworkarea() and restoreworkarea() procedures function as a
   stack. That is, the first work area saved is the last work area restored.
   Up to 20 work areas can be saved at one time.

   Use saveworkarea() and restoreworkarea() to write generic routines
   without having to worry about the current selected database.
   Suppose there are two different procedures, ProcA() and ProcB(), to call a
   single procedure ProcC(). However, given the manner in which ProcA() is
   encoded, it expects the current work area to be #2 while ProcB() expects
   work area #3. Therefore, whenever ProcC() is entered, the current selected
   work area could be either #2 or #3. Now, if ProcC() requires the work area
   to be #1, then it can use the saveworkarea() function to save the
   current work area.

 Example
   #define EXAMPLE_DATABASE
   #include example.hdr

   dbfdef sNames4                // no fields will be referenced
   enddef
   
   proc Test_restoreworkarea
   open sTest                   // open source database
   copy to "snames4.dbf"        // copy database
   open sNames4                 // open second database
   select sTest                 // select first database
   ? dbf()                      // print "stest.dbf"
   saveworkarea()               // save the workarea
   select sNames4               // select other database
   ? dbf()                      // print "snames4.dbf"
   restoreworkarea()            // restore the saved workarea
   ? dbf()                      // print "stest.dbf"
   close all                    // clean up
   erase "snames4.dbf"
   erase "snames4.dbt"
   endproc

   proc main
   Test_restoreworkarea()
   endproc

See Also: saveworkarea()

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