How to Display More than One Record at a TimeID: Q120290 2.5x 2.60 2.60a 3.00 | 2.00 2.5x 2.60 2.60a | 2.5x 2.60a | 2.60
The information in this article applies to:
SUMMARYYou can view more than one record at a time within a screen by using the BROWSE command, but sometimes you may want to have this ability without using BROWSE. This article shows you how you can use code to create your own screen.
MORE INFORMATIONThe following code demonstrates one method you can use to create your own screen. For practical application, you will need to increase the number of @..GET commands and make the array larger than demonstrated in this example. With FONT clauses and higher resolution video drivers under FoxPro for Windows, you could display quite a few more records at one time. This example displays only two records at a time. SET TALK OFF SET SAFETY OFF USE Invoices
INDEX ON ino TAG Ino
*** Place five fields of the first two records into the array:
COPY NEXT 2 TO ARRAY myray FIELDS ino, cno, idate, itotal, salesman
*** Define the window to place the @..GETs, and @..SAYs: DEFINE WINDOW brwin ; *** Intialize and declare variables for later use:
REGIONAL m.choice, m.quitting
m.quitting = .F.
m.choice = "OK"
*** Activate the window 'Brwin' and create all the @..SAYs *** and @..GETs to create two rows of five fields and the *** button controls: ACTIVATE WINDOW brwin @ 0.250,8.571 SAY "Ino" ; *** The @...GETs below contain the array elements.
@ 1.688,9.000 GET myray(1,1) ;
@ 0.250,20.571 SAY "Cno" ;
@ 1.688,19.286 GET myray(1,2) ;
@ 0.250,32.571 SAY "Idate" ;
@ 1.688,31.286 GET myray(1,3) ;
@ 0.250,44.571 SAY "Itotal" ;
@ 1.688,43.286 GET myray(1,4) ;
@ 0.250,54.857 SAY "Salesman" ;
@ 1.688,57.000 GET myray(1,5) ;
@ 3.250,9.000 GET myray(2,1) ;
@ 3.250,19.286 GET myray(2,2) ;
@ 3.250,31.286 GET myray(2,3) ;
@ 3.250,43.286 GET myray(2,4) ;
@ 3.250,57.000 GET myray(2,5) ;
*** Here is the push button containing controls to display the
*** next two records, the top two records, the previous two
*** records, the bottom two records, or to exit the screen. See
*** the VALID function Control() below.
@ 5.250,1.714 GET choice ; IF NOT WVISIBLE("Brwin")
ENDIF
READ CYCLE *** Clear the ON ERROR setting, and release the window Brwin *** after the READ is cleared. ON ERROR RELEASE WINDOW brwin *** Supporting Procedures and Functions: *** This error code traps one thing. It is looking for *** an EOF error. If one is found, the last two records are *** displayed, with the WAIT WINDOW message. PROCEDURE brerr PARAMETER errid IF errid=4 ENDIF
RETURN *** Control code for the above push button: #REGION 1
DO CASE
RETURN
REFERENCES"Interface Guide," version 2.0 (MS-DOS), Chapter 12 "User's Guide," version 2.5x, 2.6, 2.6a (MS-DOS), Chapter 12 "User's Guide," version 2.5x, 2.6, 2.6a (Windows), Chapter 11 Additional reference words: VFoxWin 3.00 FoxDos FoxWin 2.00 2.50 2.50a 2.50b 2.50c 2.60 2.60a scroll multiple KBCategory: KBSubcategory: FxprgBrowse
|
|
Last Reviewed: May 22, 1998 © 1999 Microsoft Corporation. All rights reserved. Terms of Use. |