home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast.iso / pcmag / vol9n13.zip / ACTMENU.PRG next >
Text File  |  1990-04-03  |  6KB  |  156 lines

  1. ***********************************************************************
  2. * ACTMENU.PRG - Demonstrate FoxPro ACTIVATE MENU
  3. ***********************************************************************
  4. CLEAR
  5. SET BORDER TO SINGLE                  && Single line border
  6. *
  7. * Confine to our window
  8. *
  9. DEFINE WINDOW win1 FROM 2,5 TO 23,74 TITLE "ACTMENU.PRG"
  10. ACTIVATE WINDOW win1
  11. *
  12. * First define the actionbar
  13. *
  14. DEFINE MENU foxmenu
  15. DEFINE PAD systemp  OF foxmenu PROMPT '\<System'   AT 00,00
  16. DEFINE PAD filep    OF foxmenu PROMPT '\<File'     AT 00,08
  17. DEFINE PAD editp    OF foxmenu PROMPT '\<Edit'     AT 00,14
  18.  
  19. ON PAD systemp OF foxmenu  ACTIVATE POPUP syspop
  20. ON PAD filep   OF foxmenu  ACTIVATE POPUP filepop
  21.  
  22. ON SELECTION PAD editp OF foxmenu DO msgwin WITH "You chose PAD ";
  23.    +PAD()+" of the "+MENU()+" menu",;
  24.    "Menu pad "+'"'+ALLTRIM(PROMPT())+'"'+" is not implemented"
  25. *
  26. * Now define the drop-down menus
  27. *
  28. DEFINE POPUP syspop FROM 01,00 SHADOW
  29. DEFINE BAR  1 OF syspop    PROMPT ' \<About FoxPro...'
  30. DEFINE BAR  2 OF syspop    PROMPT ' \<Help...         F1'
  31. DEFINE BAR  3 OF syspop    PROMPT ' \<Macros...'
  32. DEFINE BAR  4 OF syspop    PROMPT '\-'    SKIP
  33. DEFINE BAR  5 OF syspop    PROMPT ' \<Filer'
  34. DEFINE BAR  6 OF syspop    PROMPT ' \<Calculator'
  35. DEFINE BAR  7 OF syspop    PROMPT ' Calendar/\<Diary'
  36. DEFINE BAR  8 OF syspop    PROMPT ' \<Special Characters '
  37. DEFINE BAR  9 OF syspop    PROMPT ' ASC\<II Chart'
  38. DEFINE BAR 10 OF syspop    PROMPT ' Ca\<pture'
  39. DEFINE BAR 11 OF syspop    PROMPT ' Pu\<zzle'
  40.  
  41. DEFINE POPUP filepop FROM 01,08 SHADOW
  42. DEFINE BAR  1 OF filepop   PROMPT ' \<New...'
  43. DEFINE BAR  2 OF filepop   PROMPT ' \<Open...'
  44. DEFINE BAR  3 OF filepop   PROMPT ' \<Close'
  45. DEFINE BAR  4 OF filepop   PROMPT '\-'  SKIP
  46. DEFINE BAR  5 OF filepop   PROMPT '\ \<Save'            && Unselectable
  47. DEFINE BAR  6 OF filepop   PROMPT '\ Sa\<ve As...'
  48. DEFINE BAR  7 OF filepop   PROMPT '\ \<Revert'
  49. DEFINE BAR  8 OF filepop   PROMPT '\-' SKIP
  50. DEFINE BAR  9 OF filepop   PROMPT ' Pr\<inter Setup... '
  51. DEFINE BAR 10 OF filepop   PROMPT ' \<Print...'
  52. DEFINE BAR 11 OF filepop   PROMPT '\-' SKIP
  53. DEFINE BAR 12 OF filepop   PROMPT ' \<Quit'
  54.  
  55. ON SELECTION POPUP syspop  DO sysproc
  56. ON SELECTION POPUP filepop DO fileproc
  57.  
  58. DO WHILE .T.
  59.    ACTIVATE MENU foxmenu              && Stays active until DEACTIVATE MENU command
  60.    && or ESC pressed (which deactivates it)
  61.    IF (MENU()=="")                    && IF menu has been deactivated
  62.       EXIT                            && Leave the loop
  63.    ENDIF
  64. ENDDO .T.
  65. RELEASE MENU foxmenu                  && Remove menu from memory
  66. RELEASE POPUPS ALL                    && Remove popups from memory
  67. RELEASE WINDOW win1
  68. RETURN
  69.  
  70. ***********************************************************************
  71. * PROCEDURE Sysproc handles options chosen from the System menu
  72. ***********************************************************************
  73. PROCEDURE sysproc                     && Handle System menu options
  74. * HIDE POPUP Syspop
  75. DO msgwin WITH "You chose BAR ";
  76.    +ALLTRIM(STR(BAR()))+" of the "+POPUP()+" popup",;
  77.    "Option "+'"'+ALLTRIM(PROMPT())+'"'+" is not implemented"
  78. DO CASE
  79. CASE BAR() = 1                                  && About FoxPro...
  80.    * Do something
  81. CASE BAR() = 2                                  && Help...
  82.    * Do something
  83. CASE BAR() = 3                                  && Macros...
  84.    * Do something
  85. CASE BAR() = 4                                  && -----------
  86.    * Do something
  87. CASE BAR() = 5                                  && Filer
  88.    * Do something
  89. CASE BAR() = 6                                  && Calculator
  90.    * Do something
  91. CASE BAR() = 7                                  && Calendar/Diary
  92.    * Do something
  93. CASE BAR() = 8                                  && Special Characters
  94.    * Do something
  95. CASE BAR() = 9                                  && ASCII Chart
  96.    * Do something
  97. CASE BAR() = 10                                 && Capture
  98.    * Do something
  99. CASE BAR() = 11                                 && Puzzle
  100.    * Do something
  101. ENDCASE
  102. RETURN
  103.  
  104. ***********************************************************************
  105. * PROCEDURE Fileproc handles options chosen from the File menu
  106. ***********************************************************************
  107. PROCEDURE fileproc                    && Handle File menu options
  108. * HIDE POPUP Filepop
  109. DO msgwin WITH "You chose BAR ";
  110.    +ALLTRIM(STR(BAR()))+" of the "+POPUP()+" popup",;
  111.    "Option "+'"'+ALLTRIM(PROMPT())+'"'+" is not implemented"
  112. DO CASE
  113. CASE BAR() = 1                                  && New...
  114.    * Do something
  115. CASE BAR() = 2                                  && Open...
  116.    * Do something
  117. CASE BAR() = 3                                  && Close
  118.    * Do something
  119. CASE BAR() = 4                                  && ---------
  120.    * Do something
  121. CASE BAR() = 5                                  && Save'
  122.    * Do something
  123. CASE BAR() = 6                                  && Save As...
  124.    * Do something
  125. CASE BAR() = 7                                  && Revert'
  126.    * Do something
  127. CASE BAR() = 8                                  && ---------
  128.    * Do something
  129. CASE BAR() = 9                                  && Printer Setup...
  130.    * Do something
  131. CASE BAR() = 10                                 && Print...
  132.    * Do something
  133. CASE BAR() = 11                                 && --------
  134.    * Do something
  135. CASE BAR() = 12                                 && Quit'
  136.    DEACTIVATE MENU                              && Finished...
  137. ENDCASE
  138. RETURN
  139.  
  140. ***********************************************************************
  141. * PROCEDURE msgwin Displays some messages in a window and waits for
  142. *           a keypress
  143. ***********************************************************************
  144. PROCEDURE msgwin                       && Display window to user
  145. PARAMETER TEXT, text1
  146. DEFINE WINDOW msgwin FROM 15,20 TO 21,71 TITLE '&text1' SHADOW
  147. ACTIVATE WINDOW msgwin
  148. @ 1, (50 - LEN(TEXT))/2 SAY TEXT
  149. @ 2, (50 - LEN(text1))/2 SAY text1
  150. @ 4, 7 SAY 'Press any key or click on the mouse'
  151. =INKEY(0,'HM')                         && wait for keypress or mouse click
  152. RELEASE WINDOW msgwin
  153. RETURN
  154.  
  155. * EOF
  156.