Creating menu in Foxpro for DOS

Submitted by Karthikeyan on

This is an example of simple navigation menu programming in Foxpro 2.6


set talk off
set stat off
set scor off
set cent on
set date brit
do whil .t.
   clea
   @5,20 to 19,45 doub
   @6,25 say "MAIN MENU"
   @7,21 to 7,44 doub
   k=0
   @ 9,25 prompt "DATA ENTRY"
   @11,25 prompt "REPORT PRINTING"
   @13,25 prompt "PROCESS"
   @15,25 prompt "EXIT"
   @17,25 prompt "QUIT to SYSTEM"
   menu to k
   do case
      case k=1
           do dataent
      case k=2
           do repoprn
      case k=3
*           do proces
      case k=4
           exit
      case k=5
           clos all
           clea all
           quit
      otherwise
           loop
   endcase
enddo                            
clos all
clea all



proce dataent
do whil .t.
   clea
   @5,20 to 19,55 doub
   @6,30 say "DATA ENTRY MENU"
   @7,21 to 7,54
   k1=0
   @ 9,25 prompt "1. STUDENT"
   @11,25 prompt "2. STAFF"
   @13,25 prompt "3. FEES "
   @15,25 prompt "4. COURSES"
   @17,25 prompt "RETURN TO MAINMENU"
   menu to k1
   do case 
      case k1=1
           do stud
      case k1=2
           do staff
      case k1=3
           do fees
      case k1=4
           do course
      case k1=5
           exit     
      otherwise
           loop     
   endcase
enddo 
clos all  
return
          
proce repoprn
do whil .t.
   clea
   @5,20 to 19,55 doub
   @6,30 say "REPORT MENU"
   @7,21 to 7,54
   k1=0
   @ 9,25 prompt "Report 1"
   @11,25 prompt "Report 2"
   @13,25 prompt "Report 3"
   @15,25 prompt "Report 4"
   @17,25 prompt "Return to Mainmenu"
   menu to k2
   do case 
      case k2=1
           do fmainprn
      case k2=2
           do fothrprn
      case k2=3
           do mainprn
      case k2=4
           do othrprn
      case k2=5
           exit     
      otherwise
           loop     
   endcase
enddo 
clos all  
return          

Recommended :
FoxPro e-Book
  1. FoxPro Programming Quick Reference e-Book (New! Revised Edition)