STORE 0 TO mdel
CREATE BUTTON "PgUp" AT 21,8
CREATE BUTTON "PgDn" AT 21,24
CREATE BUTTON "First" AT 21,40
CREATE BUTTON "Last" AT 21,56
CREATE POPUP menu "FILE" "List all;New Record;Delete;Reindex;Browse;Zap;Quit" AT 5,5
CREATE POPUP menu "SEARCH" "Find First;Find Last;Find by Name;Sort by Name;Sort by Record #" AT 5,5
CREATE POPUP menu "OPTIONS" "Get Color;Exit Color;Say Color;Read Color;Deleted on-off" AT 5,5
*Note that "from" menus must be spelled exactly alike, including case.
CREATE PULLDOWN MENU "bigmenu" FROM "FILE","SEARCH","OPTIONS"
SET menu TO "bigmenu"
@ 1,1 TO 21,75 double
@ 2,24 SAY 'Windows/286 Demo' FONT 12
@ 5,3 SAY 'Name'
@ 5,40 SAY 'SSN'
@ 8,3 SAY 'Address'
@ 11,3 SAY 'City'
@ 11,45 SAY 'State'
@ 11,55 SAY 'Zip'
@ 14,3 SAY 'Phone'
@ 14,45 SAY 'Date'
USE name
STORE 1 TO pass
DO WHILE .T.
  IF DELETED()
    @ 18,3 SAY 'Deleted Rec
  ELSE
    @  18,3 SAY 'Active Rec '
  ENDIF
  IF pass <> 0
    @ 18,20 SAY 'Record # ' + str(recno(),4)
    @ 5,8 GET name MESSAGE 'Enter the Customer Name'
    @ 5,44 GET ssn MESSAGE 'Enter the Customer Social Security Number'
    @ 8,11 GET address
    @ 11,8 GET city
    @ 11,51 GET state MESSAGE "Enter only 'WA'" VALID state = 'WA' ;
      ERROR "Please enter only 'WA' for this field"
    @ 11,59 GET zip
    @ 14,9 GET phone PICTURE '(###)###-####'
    @ 14,50 GET date
    READ
  ELSE
    CLEAR GETS
  ENDIF
  STORE pass + 1 TO pass
  STORE event() TO dowhat
  DO CASE
    CASE dowhat = 1 | keyboard event
      SKIP
      IF EOF()
        BEEP
        SKIP -1
      ENDIF
    CASE dowhat = 2 | menu event
      menunum = HMENU()  | returns the horizontal menu number 
      menuitem = VMENU()   | returns the vertical menu number
      IF menunum = 1
        DO CASE
          CASE menuitem = 1
            SET CONSLOE OFF
            LIST ALL name, address, city, state, zip TO PRINT
            SET CONSOLE ON
            GO TOP
            EJECT
          CASE menuitem = 2
            APPEND BLANK
          CASE menuitem = 3
            DELETE
            @ 18,30 SAY 'Deleted'
          CASE menuitem = 4
            USE name
            INDEX ON name TO name
            USE name INDEX name
          CASE menuitem = 5
            BROWSE
          CASE menuitem = 6
            ZAP
          CASE menuitem = 7
            EXIT
        ENDCASE
      ELSE
        IF menunum = 2
          DO CASE
            CASE menuitem = 1
              GOTO TOP
            CASE menuitem = 2
              GOTO BOTTOM
            CASE menuitem = 3
              @ 18,3 SAY space(50)
              SET INDEX TO name
              STORE SPACE(20 TO mname
              @ 18,3 SAY 'Enter the name to find ' GET mname
              READ
              @ 18,3 SAY SPACE(50)
              STORE trim(mname) mnamE
              FIND mname
              IF EOF()
                BEEP
                GOTO BOTTOM
              ENDIF
            CASE menuitem = 4
              USE name INDEX name 
            CASE menuitem = 5
              USE name
          ENDCASE
        ELSE
          DO CASE
            CASE menuitem = 1
              SET GET VIDEO TO 7
            CASE menuitem = 2
              SET EXIT VIDEO TO 7
            CASE menuitem = 3
              SET SAY VIDEO TO 112
            CASE menuitem = 4
              SET READ VIDEO TO 7
            CASE menuitem = 5
              IF mdel = 0
                mdel = 1
                SET DELETED ON
              ELSE
                mdel = 0
                SET DELETED OFF
              ENDIF
          ENDCASE
        ENDIF
      ENDIF
    CASE dowhat = 6 | BUTTON event
      STORE BUTTON() TO btext
      DO CASE
        CASE btext = 'PgUp'
          SKIP -1
          IF BOF()
            BEEP
            SKIP
          ENDIF
        CASE btext = 'PgDn'
          SKIP
          IF EOF()
            BEEP
            SKIP -1
          ENDIF
        CASE btext = 'First'
          GOTO TOP
        CASE btext = 'Last'
          GOTO BOTTOM
        OTHERWISE
          ?
          ?
          ? 'Not certain as to what you have tried to do.'
          WAIT 'Please press any key to try again....'
      ENDCASE
   ENDCASE
ENDDO
SET MENU TO
CLOSE ALL
RETURN