CT_SAVEGETS

 SAVEGETS()
 Saves the GET settings of the active environment
------------------------------------------------------------------------------
 Syntax

     SAVEGETS() --> aSavedGets

 Returns

     SAVEGETS() returns an array that contains all information necessary to
     save the active GET environment.

 Description

     SAVEGETS() only returns the array with the current GET object.  This
     allows you to save it to a LOCAL variable and restore it later to the
     previous GET settings through RESTGETS().  This way, it is also possible
     to newly open a GET mask or VALID UDF from within a KEYTRAP procedure
     without losing the previous one.

 Notes

     Important!  Never use the Clipper CLEAR or CLEAR GETS commands
     within the SAVEGETS()/RESTGETS() construction.

     .  The array returned by SAVEGETS() is valid only during the
        current program run.  Therefore, it is not useful to save this data
        in the file.

     .  Effective with Clipper, the cursor position is always saved
        when you leave an input field.  If you do not want to do this, place
        the key code for Pos1 in the keyboard buffer through KEYSEND at the
        end of the trap procedure.

 Example

     F1 activates the HELP procedure from an input mask.  The active GET is
     saved there and then newly opened.  Both GET masks use different PICTURE
     definitions like different VALID UDF's:

       CLEAR
        SET KEY 28 TO HELP            // KEYTRAP definition
        cFirstname  :=  SPACE(10)
        cLastname   :=  SPACE(10)
        @ 10, 10 GET cFirstname PICTURE "@!"
        @ 11, 10 GET cLastname PICTURE "@!" VALID MAINFUNC()
        READ
     *
     * HELP procedure opens new GET
     *
     PROCEDURE HELP (A, B, C)
        LOCAL aOldGets
        aOldGets := SAVEGETS()        // Save GETS
     WOPEN(4, 30, 20, 76)             // Open window
        WBOX()                        // Window border
        cHelp1  :=  SPACE(10)
        cHelp2  :=  SPACE(10)
        @ 10, 10 GET cHelp1 PICTURE "@A"
        @ 11, 10 GET cHelp2 PICTURE "@A" VALID HELPFUNC()
        READ
        RESTGETS(aOldGets)            // Recreate GETS
        WCLOSE()                      // Close window
        RETURN

     FUNCTION MAINFUNC
        SOUND(1000, 10)               // Short beep
        RETURN(.T.)

     FUNCTION HELPFUNC
        SOUND(1000, 100)              // One long beep
        RETURN(.T.)

See Also: RESTGETS()



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.