Page 1 of 1

Save and restore workarea, index etc.

Posted: Sat Jun 13, 2009 2:24 pm
by sudip
Hi All,

Is there any function/s to save and restore work areas, indexes, relations, record numbers etc (which may be used during LostFocus and GotFocus of a window)?
Do you have any idea about it?
IMHO, it is required mainly for .dbf and RDDs.

TIA.

With best regards.

Sudip

Re: Save and restore workarea, index etc.

Posted: Sat Jun 13, 2009 2:48 pm
by jparada
Hi Sudip, please take a look at following code:

Code: Select all

/****
* 
****/
Function SaveDbf( )

Return( { Select(), Iif( Used(), OrdSetFocus(), .F.) , Iif( Used(), Recno(), .F. ) } )
/********/

/****
* 
****/
Procedure RestDbf( _Arreglo )

  Select( _Arreglo[1] )
  If ValType( _Arreglo[2] ) = "C" .and. ! Empty( _Arreglo[2] )
     OrdSetFocus( _Arreglo[2] )
  Endif
  If ValType( _Arreglo[3] ) = 'N'
     Go _Arreglo[3]
  Endif

Return
/********/
I hope is helpful for you, or you can give an idea for what you need

Greetings
Javier

Re: Save and restore workarea, index etc.

Posted: Sat Jun 13, 2009 4:18 pm
by sudip
Hello Javier,

Thanks a lot. Your code will be extremely helpful :)
With best regards.
Sudip

Re: Save and restore workarea, index etc.

Posted: Tue Jun 16, 2009 11:49 am
by jayadevu
Dear Sudip,

Pls go thru the attached program, this is platform independent and extremly useful to save and restore database information.

Before changing the workarea, use dstk_push(), after your database operations use dstk_pop()

This program is from the book on clipper programming by Rick Spence.

Warm regards,

Jayadev

Re: Save and restore workarea, index etc.

Posted: Tue Jun 16, 2009 1:06 pm
by sudip
jayadevu wrote: Pls go thru the attached program, this is platform independent and extremly useful to save and restore database information.

Before changing the workarea, use dstk_push(), after your database operations use dstk_pop()

This program is from the book on clipper programming by Rick Spence.
Thanks a lot Jayadev.

Now, is it possible to add SET RELATION in those functions (both from Rick Spence and Jayadev)?

With best regards.

Sudip