home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a079 / 1.img / FPDG.LZH / VOL2NUM0 / GROCERY / GROCERY.PRG < prev   
Encoding:
Text File  |  1992-07-29  |  2.6 KB  |  77 lines

  1. *****************************************************************
  2. *     * 07/28/92            GROCERY.PRG               3:11:22   *
  3. *****************************************************************
  4. *     * Author's Name: Jeb Long                                 *
  5. *     *                                                         *
  6. *     * Description:                                            *
  7. *     * This program illustrates how to use the VALID clause    *
  8. *     * with a numeric expression                               *
  9. *****************************************************************
  10. SET TALK OFF
  11.  
  12. *********************************************************
  13. *  Set up input form window
  14. IF NOT WEXIST("grocery")
  15.      DEFINE WINDOW grocery ;
  16.         FROM INT((SROW()-14)/2),INT((SCOL()-49)/2) ;
  17.         TO INT((SROW()-14)/2)+13,INT((SCOL()-49)/2)+48 ;
  18.         TITLE "Grocery Orders" ;
  19.         SHADOW ;
  20.         PANEL ;
  21.         COLOR SCHEME 1
  22. ENDIF
  23. *******************************************************
  24. * Initialize Memory variables
  25. Store REPLI(" ",20) TO FoodItem, Name, Address, City
  26. Store 0 to Weight,Items,Volume
  27. *******************************************************
  28. * Define POPUP menu (See Chapter 16) 
  29. DEFINE POPUP Grocery FROM 2,33 IN Grocery
  30. DEFINE BAR 1 OF Grocery Prompt "Bread"
  31. DEFINE BAR 2 OF Grocery Prompt "Apples"
  32. DEFINE BAR 3 OF Grocery Prompt "Milk"
  33. ON SELECTION POPUP Grocery DO DestroyPopup
  34. *******************************************************
  35. *  Start Processing
  36. ACTIVATE WINDOW grocery
  37. @ 1,4 SAY "Enter Food Item: "
  38. @ 1,21 GET FoodItem VALID GetItem()  
  39. @ 3,13 SAY "Weight: "
  40. @ 5,14 SAY "Items:"
  41. @ 3,21 GET Weight PICTURE "@Z" VALID 3
  42. @ 5,21 GET Items  PICTURE "@Z" VALID 2
  43. @ 3,32 SAY "Pounds"   
  44. @ 7,13 SAY "Volume:"
  45. @ 7,21 GET Volume PICTURE "@Z"
  46. @ 7,32 SAY "Gallons"
  47. @ 9,4  SAY "Name:   " GET Name
  48. @ 10,4 SAY "Address:" GET Address
  49. @ 11,4 SAY "City:   " GET City
  50.  
  51. READ 
  52. RELEASE POPUP Grocery
  53. RELEASE WINDOW Grocery
  54. *******************************************************
  55. * GetItem() - Validation UDF for field FoodItem
  56. *
  57. FUNCTION GetItem  &&  Item VALID
  58. ACTIVATE POPUP Grocery
  59. Options = 0
  60. DO CASE
  61.      CASE FoodItem = "Bread"
  62.         Options = 2    && Go input items
  63.      CASE FoodItem = "Apples"
  64.         Options = 1    && Go input weight
  65.      CASE FoodItem = "Milk"
  66.         Options = 3    && Go input volume
  67. ENDCASE
  68. SHOW GET FoodItem  && Redisplay get with new value
  69. RETURN Options
  70.  
  71. *******************************************************
  72.  DestroyPopup - Deactivates Popup Grocery
  73. PROCEDURE DestroyPopup
  74. FoodItem = PROMPT()
  75. DEACTIVATE POPUP Grocery
  76. RETURN 
  77.