home *** CD-ROM | disk | FTP | other *** search
- *****************************************************************
- * * 07/28/92 GROCERY.PRG 3:11:22 *
- *****************************************************************
- * * Author's Name: Jeb Long *
- * * *
- * * Description: *
- * * This program illustrates how to use the VALID clause *
- * * with a numeric expression *
- *****************************************************************
- SET TALK OFF
-
- *********************************************************
- * Set up input form window
- IF NOT WEXIST("grocery")
- DEFINE WINDOW grocery ;
- FROM INT((SROW()-14)/2),INT((SCOL()-49)/2) ;
- TO INT((SROW()-14)/2)+13,INT((SCOL()-49)/2)+48 ;
- TITLE "Grocery Orders" ;
- SHADOW ;
- PANEL ;
- COLOR SCHEME 1
- ENDIF
- *******************************************************
- * Initialize Memory variables
- Store REPLI(" ",20) TO FoodItem, Name, Address, City
- Store 0 to Weight,Items,Volume
- *******************************************************
- * Define POPUP menu (See Chapter 16)
- DEFINE POPUP Grocery FROM 2,33 IN Grocery
- DEFINE BAR 1 OF Grocery Prompt "Bread"
- DEFINE BAR 2 OF Grocery Prompt "Apples"
- DEFINE BAR 3 OF Grocery Prompt "Milk"
- ON SELECTION POPUP Grocery DO DestroyPopup
- *******************************************************
- * Start Processing
- ACTIVATE WINDOW grocery
- @ 1,4 SAY "Enter Food Item: "
- @ 1,21 GET FoodItem VALID GetItem()
- @ 3,13 SAY "Weight: "
- @ 5,14 SAY "Items:"
- @ 3,21 GET Weight PICTURE "@Z" VALID 3
- @ 5,21 GET Items PICTURE "@Z" VALID 2
- @ 3,32 SAY "Pounds"
- @ 7,13 SAY "Volume:"
- @ 7,21 GET Volume PICTURE "@Z"
- @ 7,32 SAY "Gallons"
- @ 9,4 SAY "Name: " GET Name
- @ 10,4 SAY "Address:" GET Address
- @ 11,4 SAY "City: " GET City
-
- READ
- RELEASE POPUP Grocery
- RELEASE WINDOW Grocery
- *******************************************************
- * GetItem() - Validation UDF for field FoodItem
- *
- FUNCTION GetItem && Item VALID
- ACTIVATE POPUP Grocery
- Options = 0
- DO CASE
- CASE FoodItem = "Bread"
- Options = 2 && Go input items
- CASE FoodItem = "Apples"
- Options = 1 && Go input weight
- CASE FoodItem = "Milk"
- Options = 3 && Go input volume
- ENDCASE
- SHOW GET FoodItem && Redisplay get with new value
- RETURN Options
-
- *******************************************************
- DestroyPopup - Deactivates Popup Grocery
- PROCEDURE DestroyPopup
- FoodItem = PROMPT()
- DEACTIVATE POPUP Grocery
- RETURN
-