home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a079 / 1.img / FPDG.LZH / VOL2NUM0 / KEYBOARD / KEYBOARD.PRG < prev   
Encoding:
Text File  |  1993-02-01  |  2.3 KB  |  62 lines

  1. *****************************************************************
  2. *     * 09/92               Keyboard.prg                        *
  3. *****************************************************************
  4. *     * Author's Name: Jeb Long                                 *
  5. *     *                                                         *
  6. *     * Description:                                            *
  7. *     *  This program demonstrates the use of the KEYBOARD                        *
  8. *     *  function. A prompt is issued requesting that a file                *
  9. *     *  name be entered. If you press the Enter key, a popup            *
  10. *     *  of file names appears. When you select a file, the                 *
  11. *     *  file name is stuffed into the typeahead buffer, which        *
  12. *     *  is read into the input field by the READ command.      *
  13. *****************************************************************
  14. SET TALK OFF
  15. CLEAR
  16. DEFINE POPUP GetFile FROM 6,30 PROMPT FILES LIKE *.DBF
  17. ON READERR ?? ""   && Suppress read error intercept
  18. ON SELECTION POPUP GetFile DO action
  19. dbffile='                                '
  20. testfile= ' '
  21. @ 5,1 SAY "Enter a database file name (or press Enter)" ;
  22.        GET dbffile valid testx(dbffile)
  23. READ
  24. WAIT "The filename is: " + dbffile WINDOW NOWAIT
  25. RETURN
  26. ***********************************************************
  27. *
  28. *  Function:  Testx(filename)
  29. *  Description: UDF activates directory popup to select 
  30. *               the file name if the user did not enter a 
  31. *               file name.
  32. *  Input:  File name character string
  33. *  Output: Logical true value if file name was entered.
  34. *          Otherwise, a logical false is returned.
  35. *
  36. FUNCTION Testx
  37. PARAMETER filename
  38. IF .NOT. EMPTY(filename)
  39.     RETURN .T.         && User entered file name, return valid
  40. ENDIF
  41. ACTIVATE POPUP GetFile
  42. TestFile = PROMPT()     && Fetch selected file name
  43. DEACTIVATE POPUP
  44. IF TestFile = ' '
  45.     ?? chr(7)          && File name was not selected...  
  46. ELSE
  47.     KEYBOARD TestFile  && Stuff file name into typeahead
  48.                         && buffer with file name that will
  49.                         && be read by the GET command
  50. ENDIF
  51. RETURN .F.
  52. ***********************************************************
  53. *
  54. *   POPUP menu action procedure
  55. *
  56. PROCEDURE action
  57. testfile = PROMPT()   && Fetch the file name
  58. DEACTIVATE POPUP
  59. RETURN
  60.  
  61.