home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / CLIPPER / NANNWS35.ARC / UDREX.PRG < prev   
Encoding:
Text File  |  1989-03-01  |  2.1 KB  |  26 lines

  1. * Program: UDRex.prg
  2. * Author:  Arthur Stalk
  3. * Version: McMax 2.0
  4. * Note(s): Example of the correct use of a user-defined READ.
  5. *          Also includes examples of pop-up menus and buttons.
  6. *
  7. * Copyright (c) 1989 Nantucket Corporation.
  8.  
  9. SET PROCEDURE SELF
  10. SET TALK OFF
  11. CLEAR
  12. dummy = ENABLEITEM("Quit",.T.)  && Enables QUIT from file menu.
  13.  
  14. USE employee INDEX employee  && This .DBF contains
  15.                              && fields Name,Occuptn,Yearly.
  16. readOK = SETREAD("MYREAD")   && Assigns MYREAD as read procedure.
  17. IF readOK
  18.   GO TOP
  19.   @2, 10  SAY "Name                " GET name
  20.   @4, 10  SAY "Occupation        " GET occuptn
  21.   @6, 10  SAY "Yearly Salary    " GET yearly
  22.   @8, 10  SAY "Weekly Salary   "
  23.   @8, 26 SAY yearly/ 52 PICTURE "###,###.##"
  24.  
  25.   @12,10 BUTTON "Previous",1 && The following three statements
  26.   @12,25 BUTTON "Next",2     && place three buttons on the screen
  27.   @12,40 BUTTON "Done",3     && with Previous, Next, and Done as
  28.                              && their titles.
  29.   READ
  30. ENDIF
  31. dummy = ENABLEITEM("Quit",.F.)  && Disable "Quit" option.
  32. CLEAR
  33. RETURN
  34.  
  35. PROCEDURE MyRead
  36. PRIVATE cGet, nGet, mode, theMenu, theButton
  37.  
  38. cGet = NEXTGET()
  39. DO WHILE cGet <> 0
  40.   mode = READGET(cGet)
  41.   nGet  = NEXTGET()
  42.   
  43.   IF mode = 1                && READGET() exited normally.
  44.     IF cGET = 3
  45.       @8,26 SAY yearly/52 PICTURE "###,###.##"
  46.     ENDIF
  47.   ENDIF
  48.  
  49.   IF mode = 4
  50.     theMenu = MENUHIT()
  51.     DO CASE
  52.       CASE theMenu = ASC("Quit")
  53.         dummy = READGET(0)   && Clears the READGET() border.
  54.         nGet = 0
  55.     ENDCASE
  56.   ENDIF
  57.  
  58.   IF mode = 5
  59.     theButton = BUTTONHIT()
  60.     DO CASE
  61.       CASE theButton = 1
  62.         SKIP -1
  63.         IF BOF()
  64.           ?? CHR(7)
  65.           GO TOP
  66.         ENDIF
  67.         @8,26 SAY yearly/52 PICTURE "###,###.##"
  68.        CASE theButton = 2    && Next Button.
  69.           SKIP
  70.           IF EOF()
  71.              ?? CHR(7)
  72.              GO BOTTOM
  73.            ENDIF
  74.         @8,26 SAY yearly/52 PICTURE "###,###.##"
  75.         
  76.         CASE theButton = 3   && Finished !!!
  77.           dummy = READGET(0) && Clears READ border.
  78.           nGet = 0
  79.         ENDCASE
  80.     ENDIF
  81.     cGet = nGet
  82. ENDDO
  83. RETURN
  84.