home *** CD-ROM | disk | FTP | other *** search
- *****************************************************************
- * Test program for DBVIEW function - FILE T_DBVIEW.PRG
- *****************************************************************
-
- * Copyright(c) 1991 -- James Occhiogrosso
-
- * Displays a window of customer records if entered
- * account ID is not found in customer database.
-
- # include "inkey.ch"
- # include "box.ch"
-
- * Force linking of DBVIEW function
- EXTERNAL DBVIEW
-
- PRIVATE mcustid := SPACE(6), address1 := SPACE(30)
-
- INITGLOBAL()
- SETCOLOR(colstd)
- CLEAR
-
- * Set SOFTSEEK on to prevent the window
- * from starting at the end of the file.
- SET SOFTSEEK ON
-
- * 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
-
- @ 5, 12 GET mcustid PICTURE "!!!999" ;
- VALID CHKKEY("customer", "mcustid", "custview", ;
- 5, 20, 50, "company")
-
- @ 7, 12 GET address1
-
- READ
- ENDDO
-
- RETURN
-
-
- *****************************************************************
- FUNCTION CUSTVIEW
- *****************************************************************
-
- * Note that on entry to this procedure from CHKKEY, the FOUND()
- * status is not altered. We use it here to determine if we need
- * to display the customer window.
- *
-
- LOCAL dbe_view := ARRAY(1), headings := old_color := ;
- old_screen := '', old_record := RECNO()
-
- IF .NOT. FOUND()
-
- * Save screen values
- old_color := SETCOLOR(colwindow)
- old_screen := SCRNSAVE(7, 29, 19, 75)
-
- * Box window and set up DBEDIT view
- @ 7, 29, 19, 75 BOX B_SINGLE + ' '
- dbe_view[1] = '" " + custid + " │ " + company + " "'
- headings := 'Cust. ID Company Name'
-
- * Call DBEDIT using DBVIEW to handle messages
- DBEDIT( 8, 31, 18, 73, dbe_view, 'dbview', '', headings)
-
- * Return selection to mcustid variable
- mcustid = custid
-
- * Restore screen
- SETCOLOR(old_color)
- SCRNREST(old_screen)
-
- * Return to original Customer record. The cursor is on
- * custid GET as if this procedure never executed. An Enter
- * is placed in the keyboard so that when CUSTVIEW returns,
- * CHKKEY is called again. The cycle repeats and since the
- * the customer ID is now valid, CHKKEY displays the customer
- * name. When CUSTVIEW is called for the second time it simply
- * returns immediately. Thus, both an account number and name
- * are displayed.
-
- GOTO old_record
- KEYBOARD CHR(K_ENTER)
- ENDIF
-
- RETURN FOUND()
-
-