home *** CD-ROM | disk | FTP | other *** search
- *****************************************************************
- * * 09/92 Keyboard.prg *
- *****************************************************************
- * * Author's Name: Jeb Long *
- * * *
- * * Description: *
- * * This program demonstrates the use of the KEYBOARD *
- * * function. A prompt is issued requesting that a file *
- * * name be entered. If you press the Enter key, a popup *
- * * of file names appears. When you select a file, the *
- * * file name is stuffed into the typeahead buffer, which *
- * * is read into the input field by the READ command. *
- *****************************************************************
- *
- SET TALK OFF
- CLEAR
- DEFINE POPUP GetFile FROM 6,30 PROMPT FILES LIKE *.DBF
- ON READERR ?? "" && Suppress read error intercept
- ON SELECTION POPUP GetFile DO action
- dbffile=' '
- testfile= ' '
- @ 5,1 SAY "Enter a database file name (or press Enter)" ;
- GET dbffile valid testx(dbffile)
- READ
- WAIT "The filename is: " + dbffile WINDOW NOWAIT
- RETURN
- ***********************************************************
- *
- * Function: Testx(filename)
- * Description: UDF activates directory popup to select
- * the file name if the user did not enter a
- * file name.
- * Input: File name character string
- * Output: Logical true value if file name was entered.
- * Otherwise, a logical false is returned.
- *
- FUNCTION Testx
- PARAMETER filename
- IF .NOT. EMPTY(filename)
- RETURN .T. && User entered file name, return valid
- ENDIF
- ACTIVATE POPUP GetFile
- TestFile = PROMPT() && Fetch selected file name
- DEACTIVATE POPUP
- IF TestFile = ' '
- ?? chr(7) && File name was not selected...
- ELSE
- KEYBOARD TestFile && Stuff file name into typeahead
- && buffer with file name that will
- && be read by the GET command
- ENDIF
- RETURN .F.
- ***********************************************************
- *
- * POPUP menu action procedure
- *
- PROCEDURE action
- testfile = PROMPT() && Fetch the file name
- DEACTIVATE POPUP
- RETURN
-