home *** CD-ROM | disk | FTP | other *** search
- * Program: UDRex.prg
- * Author: Arthur Stalk
- * Version: McMax 2.0
- * Note(s): Example of the correct use of a user-defined READ.
- * Also includes examples of pop-up menus and buttons.
- *
- * Copyright (c) 1989 Nantucket Corporation.
-
- SET PROCEDURE SELF
- SET TALK OFF
- CLEAR
- dummy = ENABLEITEM("Quit",.T.) && Enables QUIT from file menu.
-
- USE employee INDEX employee && This .DBF contains
- && fields Name,Occuptn,Yearly.
- readOK = SETREAD("MYREAD") && Assigns MYREAD as read procedure.
- IF readOK
- GO TOP
- @2, 10 SAY "Name " GET name
- @4, 10 SAY "Occupation " GET occuptn
- @6, 10 SAY "Yearly Salary " GET yearly
- @8, 10 SAY "Weekly Salary "
- @8, 26 SAY yearly/ 52 PICTURE "###,###.##"
-
- @12,10 BUTTON "Previous",1 && The following three statements
- @12,25 BUTTON "Next",2 && place three buttons on the screen
- @12,40 BUTTON "Done",3 && with Previous, Next, and Done as
- && their titles.
- READ
- ENDIF
- dummy = ENABLEITEM("Quit",.F.) && Disable "Quit" option.
- CLEAR
- RETURN
-
- PROCEDURE MyRead
- PRIVATE cGet, nGet, mode, theMenu, theButton
-
- cGet = NEXTGET()
- DO WHILE cGet <> 0
- mode = READGET(cGet)
- nGet = NEXTGET()
-
- IF mode = 1 && READGET() exited normally.
- IF cGET = 3
- @8,26 SAY yearly/52 PICTURE "###,###.##"
- ENDIF
- ENDIF
-
- IF mode = 4
- theMenu = MENUHIT()
- DO CASE
- CASE theMenu = ASC("Quit")
- dummy = READGET(0) && Clears the READGET() border.
- nGet = 0
- ENDCASE
- ENDIF
-
- IF mode = 5
- theButton = BUTTONHIT()
- DO CASE
- CASE theButton = 1
- SKIP -1
- IF BOF()
- ?? CHR(7)
- GO TOP
- ENDIF
- @8,26 SAY yearly/52 PICTURE "###,###.##"
- CASE theButton = 2 && Next Button.
- SKIP
- IF EOF()
- ?? CHR(7)
- GO BOTTOM
- ENDIF
- @8,26 SAY yearly/52 PICTURE "###,###.##"
-
- CASE theButton = 3 && Finished !!!
- dummy = READGET(0) && Clears READ border.
- nGet = 0
- ENDCASE
- ENDIF
- cGet = nGet
- ENDDO
- RETURN