home *** CD-ROM | disk | FTP | other *** search
- *****************************************************************
- * Test program for CHKKEY functions - FILE T_CHKKEY.PRG
- *****************************************************************
-
- * Copyright(c) 1991 -- James Occhiogrosso
-
- # include "inkey.ch"
-
- PRIVATE morderno := 0
-
- * Initialize global colors and clear screen
- INITGLOBAL()
- SETCOLOR(colstd)
- CLEAR
-
- * Open the test files and set relationship
-
- USE customer INDEX customer NEW
- USE orders INDEX orders NEW
- SET RELATION TO custid INTO customer
-
- DO WHILE LASTKEY() != K_ESC // Exit on ESC key.
-
- * If the order number exists, CHKKEY displays the company
- * from customer. Uses ORDER_INFO optionally to display
- * other related items or perform computations.
-
- @ 5, 3 SAY 'Order No: ' GET morderno PICTURE "999999" ;
- VALID CHKKEY("orders","morderno","order_info", ;
- 5, 30, 70, "customer->company", ;
- "customer->custid", ' - ')
-
- READ
- ENDDO
-
- RETURN
-
- *****************************************************************
- FUNCTION ORDER_INFO
- *****************************************************************
- *
- * This is a simple UDF for CHKKEY. If it finds the order number,
- * it displays corresponding data from the order file. Otherwise,
- * it clears the associated screen area.
-
- LOCAL oldcolor := SETCOLOR(colhelp1)
-
- IF FOUND()
- @ 6, 30 SAY 'Part number: ' + orders->partno
- @ 7, 30 SAY 'Price: $ ' + LTRIM(STR(orders->price))
- ELSE
- @ 6, 30 CLEAR TO 7, 70
- ENDIF
-
- * Note that CHKKEY's return value can be altered if desired
- SETCOLOR(oldcolor)
- RETURN FOUND()
-
-