CT_PEEKBYTE

 PEEKBYTE()
 Reads a byte from memory
------------------------------------------------------------------------------
 Syntax

     PEEKBYTE(<nSegment|cHexSegment>,<nOffset|cHexOffset>)
         --> nByte

 Arguments

     <nSegment|cHexSegment>  Designates the segment address from which
     the byte is read.  This value can be a decimal integer or hexadecimal
     string.  The maximum is 65520 ("FFF0" Hex).

     <nOffset|cHexOffset>  Designates the offset address within the
     segment specified by <nSegment|cHexSegment>.  This value can be a
     decimal integer or hexadecimal string.  The maximum is 65535 ("FFFF"
     Hex).

 Returns

     PEEKBYTE() returns the byte to be read or a value of -1, if there is an
     error.

 Description

     PEEKBYTE() reads a byte from a desired memory region within conventional
     memory.  You must specify the segment address and offset.

 Examples

     .  Show a decimal parameter:

        ? PEEKBYTE(1000, 2000)       // Segment 1000d, Offset 2000d

     .  Show a hexadecimal parameter:

        ? PEEKBYTE("F000", "8000")   // The byte at address F800h

See Also: PEEKWORD() POKEBYTE()

 

CT_OUTWORD

 OUTWORD()
 Sends a 16-bit word to a port
------------------------------------------------------------------------------
 Syntax

     OUTWORD(<nPort|<cHexPort>,<nOutWord|cHexOutWord>)
         --> lSuccessful

 Arguments

     <nPort|HexPort>  Designates a port address to which a word with a 16-
     bit value is passed.  This value can be a decimal integer or hexadecimal
     (sedecimal) string.  The maximum is 65520 ("FFF0" Hex).

     <nOutWord|cHexOutWord>  Designates the word passed to the specified
     port.  This value can be designated as a decimal integer or hexadecimal
     (sedecimal) string.  The maximum is 65536 ("FFFF" Hex).

 Returns

     OUTWORD() returns .T. when the operation is successfully completed.  A
     return value of .F. indicates a parameter error.

 Description

     Clipper Tools always attempts to offer finished solutions at the
     highest-possible level for such standard hardware as the serial
     interface port..  However, if, highly specialized systems and their
     ports are to receive data from Clipper, use OUTBYTE() or OUTWORD().

 Note

     .  The function does not determine if a port is open or if you
        cannot write to it.

 Examples

     Output to a 16-bit port.

     .  With a decimal parameter:

        ? OUTWORD(512, 32)          // Write word to an additional device

     .  With a hexadecimal parameter:

        ? OUTWORD("200", "20")      // Same port, same value

See Also: INWORD() OUTBYTE()

 

CT_OUTBYTE

 OUTBYTE()
 Sends a byte to a port
------------------------------------------------------------------------------
 Syntax

     OUTBYTE(<nPort|cHexPort>,<nOutByte|cHexOutByte>)
         --> lSuccessful

 Arguments

     <nPort|cHexPort>  Designates a port address to which you can pass a
     byte.  This value can be a decimal integer or hexadecimal string.

     <nOutByte|cHexOutByte>  Designates the byte passed to the specified
     port.  This value can be a decimal integer or hexadecimal string.

 Returns

     OUTBYTE() returns .T. when the operation is successfully completed.  A
     return value of .F. indicates a parameter error.

 Description

     Clipper Tools always attempts to offer finished solutions at the
     highest-possible level for such standard hardware as a serial interface
     port..  However, if highly specialized systems and their ports are to
     receive data from Clipper, use OUTBYTE() or OUTWORD().

 Note

     .  The function does not determine if a port is available, or if
        you cannot write to it.

 Examples

     Transfer a byte to the fifth port address of the first serial interface
     port.  This is only an example, since Clipper Tools has special
     serial interface port functions.

     .  With a decimal parameter:

        ? OUTBYTE(1020, 1)          // 5th port COM1, DTR On

     .  With a hexadecimal parameter:

        ? OUTBYTE("3FC", 0)         // 5th port COM1, DTR Off

See Also: INBYTE() OUTWORD()

 

CT_INWORD

 INWORD()
 Reads in a 16-bit word from a port
------------------------------------------------------------------------------
 Syntax

     INWORD(<nPort|cHexPort>) --> nWord

 Argument

     <nPort|cHexPort>  Designates a port address from which a word with a
     16-bit value is read.  This value can be a decimal integer or
     hexadecimal string.

 Returns

     INWORD() returns the word read from the designated port, or a value of -
     1 when an error occurs.

 Description

     Clipper Tools always attempts to offer finished solutions at the
     highest-possible level for such standard hardware as a serial interface
     port.  However, if you read highly specialized systems and their ports
     from Clipper, use INBYTE() or INWORD().  INWORD() allows you to read
     from interfaces that return the data from a port as a 16-bit value.

 Note

     .  A returns random value for a nonexistent port or one that
        cannot be read.

 Examples

     Show a read from a 16-bit port:

     .  With a decimal parameter:

        ? INWORD(512)           // Read from an additional device

     .  With a hexadecimal parameter:

        ? INWORD("200")         // The same port address

See Also: INBYTE() OUTWORD() NUMHIGH() NUMLOW()

 

CT_INBYTE

 INBYTE()
 Reads an 8 byte from a port
------------------------------------------------------------------------------
 Syntax

     INBYTE(<nPort|cHexPort>) --> nByte

 Argument

     <nPort|cHexPort>  Designates a port address from which a byte is
     read.  This value can be a decimal integer or hexadecimal string.

 Returns

     INBYTE() returns the byte read from the specified port; or a value of -
     1, if a parameter error occurs.

 Description

     Clipper Tools always attempts to offer finished solutions at the
     highest-possible level for such standared hardware as a serial interface
     port.  However, if you read a highly specialized systems and their ports
     from Clipper, use INBYTE() or INWORD().

 Note

     .  A random return value is produced for a nonexistent port or
        one that cannot be read.

 Examples

     These examples read the first port address of the first serial interface
     port.  This is only an example, since the Clipper Tools contains
     special port functions.

     .  With a decimal parameter:

        ? INBYTE(1016)       // 1st Port (COM1)

     .  With a hexadecimal parameter:

        ? INBYTE("3F8")      // Also 1st Port (COM1)

See Also: INWORD() OUTBYTE()

 

CT_SAVESETKEY

 SAVESETKEY()
 Saves SET KEY..TO settings in an array
------------------------------------------------------------------------------
 Syntax

     SAVESETKEY() --> aSavedTraps

 Returns

     SAVESETKEY() returns an array within which information for the current
     SET KEY..TO settings are saved.

 Description

     SAVE SET KEY..TO SETTINGS
     SAVESETKEY() saves the current SET KEY..TO settings in an array.  This
     makes it possible to redefine function keys already assigned, and to
     later restore the old settings with RESTSETKEY().

 Note

     .  The array you create is valid only for the current program
        run.  Therefore, is not useful to save this data in the file.

 Examples

     A key trap definition for the F1 key is changed within a nested input:

       CLEAR
        SET KEY 28 TO HELP1         // First def. for F1
        cFirstname := SPACE(10)
        cLastname  := SPACE(10)
        @ 10, 10 GET cFirstname
        @ 11, 10 GET cLastname
        READ

     PROCEDURE HELP1 ( A, B, C)
        WOPEN(4, 4, 20, 76)         // Open window^n   WBOX()
        // Window borders
        aOldKey := SAVESETKEY()     // Save SET KEY def.
        aOldGet := SAVEGETS()       // Save GET def.
        SET KEY 28 TO HELP2         // New def. F1
        cHelp1 := SPACE(10)         // New GET
        cHelp2 := SPACE(10)         // ...e.g. help index
        @ 10, 10 GET cFirstname
        @ 11, 10 GET cLastname
        READ
        RESTGETS(aOldGet)            // Recreate old GET
        RESTSETKEY(aOldKey)          // Return .T. if OK
        WCLOSE()                     // Close window
        RETURN

     PROCEDURE HELP2 ( A, B, C)      // 2nd help procedure
        * e.g. a second help environment - key layout etc.
        RETURN

See Also: RESTSETKEY() SAVEGETS()



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()



CT_RESTSETKEY

 RESTSETKEY()
 Restores SET KEY..TO settings from an array
------------------------------------------------------------------------------
 Syntax

     RESTSETKEY(<aSavedTraps>) --> lRestored

 Argument

     <aSavedTraps>  Designates an array previously created by
     SAVESETKEY().

 Returns

     RESTSETKEY() returns .T. when you can restore the <aSavedTraps> SET
     KEY..TO settings.

 Description

     RESTORE "SET KEY..TO" SETTING
     RESTSETKEY() restores SET KEY..TO settings previously saved to an array
     with SAVESETKEY().

     Important!  It is impossible to use the saved information any longer
     that the runtime of an application.  The character string that results
     cannot be saved to a file and reloaded later.

 Example

     A key trap definition for the F1 key is changed within a nested input:

     CLEAR
        SET KEY 28 TO HELP1          // First def. for F1
        cFirstname := SPACE(10)
        cLastname  := SPACE(10)
        @ 10, 10 GET cFirstname
        @ 11, 10 GET cLastname
     READ

     PROCEDURE HELP1 ( A, B, C)

        WOPEN(4, 4, 20, 76)          // Open window
        WBOX()                       // Window borders
        aOldKey := SAVESETKEY()      // Save SET KEY def.
        aOldGet := SAVEGETS()        // Save GET def.
        SET KEY 28 TO HELP2          // New def. F1
        cHelp1 := SPACE(10)          // New GET
     cHelp2 := SPACE(10)             // ...e.g. help index
        @ 10, 10 GET cFirstname
        @ 11, 10 GET cLastname
        READ
        RESTGETS(aOldGet)            // Recreate old GET
        RESTSETKEY(aOldKey)          // Return .T. if OK
        WCLOSE()                     // Close window
        RETURN

     PROCEDURE HELP2 ( A, B, C)      // 2nd help procedure
        * e.g. a second help environment - key layout etc.
        RETURN

See Also: SAVESETKEY()



CT_RESTGETS

 RESTGETS()
 Restores GET settings from an array
------------------------------------------------------------------------------
 Syntax

     RESTGETS(<aSavedGets>) --> lRestored

 Argument

     <aSavedGets>  Designates a variable previously created by the
     SAVEGETS() function.

 Returns

     RESTGETS() returns .T. when the GET settings are successfully restored.

 Description

     This function restores the information previously saved to an array with
     SAVEGETS().  This reactivates a previously active GET mask.

 Note

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

 Example

     F1 is used to activate the HELP procedure from an input mask.  The
     active GET is saved 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: SAVEGETS()



CT_GETSECRET

 GETSECRET()
 Keyboard input function for hidden input (similar to a GET field)
------------------------------------------------------------------------------
 Syntax

     GETSECRET(<cDefault>,[<nRow>],[<nColumn>],[<lSAY>],
        [<cPrompt>]) --> cInput

 Arguments

     <cDefault>  Designates the length and contents of the input field.

     <nRow>  Designates the row in which the input occurs.  The default
     is the current cursor position.

     <nColumn>  Designates the column in which the input occurs.  The
     default is the current cursor position.

     <lSAY>  When you specify .T. and close GETSECRET(), the actual data
     input is displayed with the default color attribute.

     <cPrompt>  Designates the text to display in front of the input
     field at the selected coordinates.

 Returns

     GETSECRET() returns the input string.

 Description

     If you call this function, a simple input field is made available.  All
     characters input are displayed as asterisks (*) to hide the actual
     input.  All control keys are interpreted exactly as in a Clipper GET
     mask.

     The length and default for the string are specified in the <cDefault>
     parameter.  This allows a normal input field to be portrayed with VAR =
     SPACE(length).  The input field starts at the current cursor position or
     at the designated row and column.

     Similar to @ ... SAY ... GET, you can also display text just before the
     input field.  The field starting position is moved accordingly

     In the Clipper SET COLOR TO command, the first color you designate is
     used for screen output; the second for input fields. GETSECRET() uses
     these color designators exactly like Clipper.  If you designate the
     <lSAY> parameter as .T., you can determine (as with a SAY), whether the
     data is redisplayed in its amended form at the point of input.  However,
     GETSECRET() only displays asterisks to hide this data.  This is useful
     when input breaks off due to an ESC, because at least the correct number
     of asterisks is displayed.  The affected area also contains the standard
     color attribute.

 Notes

     .  GETSECRET() uses the Clipper console input internal
        routines and supports the INS display in SCOREBOARD.  In addition,
        the SET ESCAPE, SET BELL, SET INTENSITY, SET DELIMITERS, and SET
        CONFIRM switches are acknowledged.

     .  Key traps may occur with GETSECRET() when the cursor position
        within a field is saved.  You can then call GETSECRET() recursively,
        as long as sufficient stack memory is available.

 Examples

     .  Show the secret field at the current cursor position:

        cVar:= SPACE(20)            // 20 position secret field
        cVar:= GETSECRET(cVar)      // Retain input attribute

     .  Show the secret a 10-space field,  row 10, column 20:

        cVar:= GETSECRET(SPACE(10), 10, 20)

     .  After input is finished, the actual data input is redisplayed
        on the screen.  This area contains the standard color attribute.  The
        input is moved by the text preceding the input field:

        SET CONFIRM ON              //  Close with RETURN
        cVar:= "Default text"
        GETSECRET(cVar, 10, 20, .T., "Please input: ")

See Also: GETINPUT()