home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 2 / ctrom_ii_b.zip / ctrom_ii_b / PROGRAM / CLIPPER / PDHM / HM_TOUR.PRG < prev    next >
Text File  |  1993-01-14  |  6KB  |  197 lines

  1. /*
  2.     HM_TOUR.PRG
  3. */
  4.  
  5.  
  6. #include "inkey.ch"
  7. #include "hormenu.ch"
  8.  
  9. //---------
  10. func main()
  11. local nTop := 3, nLeft := 0
  12. local aMenu := {;
  13.                     "Overview: What's the Hormenu Collection?",;
  14.                     "The ADhormenu() Syntax",;
  15.                     "The Default Active Keys and Mouse Spots",;
  16.                     "Demo: The Basic Implementation",;
  17.                     "The ADhormenu() APIs",;
  18.                     "Demos: Extending Its Functionality",;
  19.                     "A Quick Syntax Reference",;
  20.                     "Print Documentation";
  21.                }
  22. local aTrigger := { 1,17,20,11,17,22,16 }
  23. local aBlock := {;
  24.                     {|e| ADviewfile( "overview.hm" )},;
  25.                     {|e| ADviewfile( "syntax.hm" )},;
  26.                     {|e| ADviewfile( "keys.hm" )},;
  27.                     {|e| ADviewfile( "hm_demo1.prg", {||Xdemo1()} )},;
  28.                     {|e| ADviewfile( "api.hm" )},;
  29.                     {|e| Xfunction(e)},;
  30.                     {|e| ADviewfile( "quickref.hm" )},;
  31.                     {|e| Xprintdocs(e)};
  32.                 }
  33.  
  34. Xintro()
  35. ADvermenu( nTop, nLeft, aMenu, aTrigger, aBlock )
  36. ADcredit(13,16)
  37. setblink( .t. )
  38. return nil
  39.  
  40.  
  41. //--------------------
  42. func Xfunction( e, cDbf )
  43. local nTop := ADvm_row(e) + 1, nLeft := ADvm_left(e) + 4
  44. local aMenu := {;
  45.                     "Assigning Option-Dependent Procedures",;
  46.                     "Implementing PullDown Menus";
  47.                }
  48. local xBlock := {;
  49.                     {|e| ADviewfile( "hm_demo2.prg", {||Xdemo2()} )},;
  50.                     {|e| ADviewfile( "hm_demo3.prg", {||Xdemo3()} )};
  51.                 }
  52. ADvermenu( nTop, nLeft, aMenu, {25,11,5,5}, xBlock )
  53. return nil
  54.  
  55. //---------------
  56. func Xprintdocs(e)
  57. local nTop := ADvm_row(e) + 1, nLeft := ADvm_left(e) + 4, xx
  58. local aMenu := {;
  59.                     "Overview.hm",;
  60.                     "Syntax.hm",;
  61.                     "API.hm",;
  62.                     "Quickref.hm",;
  63.                     "HM_tour.prg",;
  64.                     "HM_demo1.prg",;
  65.                     "HM_demo2.prg",;
  66.                     "HM_demo3.prg";
  67.                 }
  68. local bConfig := {|e| ADvm_taglist(e), ADvm_returntype( e, VM_CHAR_RETVAL )}
  69. local aScn := ADmessage( { "Tag files for printing" },,, .f., .f. )
  70. local aFiles := ADvermenu( nTop, nLeft, aMenu,,, bConfig )
  71.  
  72. if isprinter()
  73.     for xx = 1 to len( aFiles )
  74.         fwrite( 4, memoread( aFiles[xx] ) )
  75.         fwrite( 4, chr(12) )
  76.     next
  77. else
  78.     ADmessage( { "Printer Not Ready",;
  79.                  "NOTE: Check out PDBM??.ZIP",;
  80.                  "for a mouseable dialog box";
  81.                 } )
  82. endif
  83.  
  84. ADrestscn( aScn )
  85. return nil
  86.  
  87.  
  88. //-----------
  89. func Xdemo1()
  90. local aMenu := { "Databases", "Utilities", "Quit" }
  91. local nSel := ADhormenu( aMenu )
  92. ADmessage( { "Selected" + str(nSel, 2) } )
  93. return nil
  94.  
  95.  
  96. //-----------
  97. func Xdemo2()
  98. local aMenu := { "Databases", "Utilities", "Quit" }
  99. ADhormenu( aMenu,, {|e| Xsel1_handler(e)} )
  100. return nil
  101.  
  102. //------------------
  103. func Xsel1_handler(e)
  104. local nSel := ADhm_current(e)
  105. local aMsg := {;
  106.                 "Selected ",;
  107.                 "Think of this message box as a major procedure that you call.",;
  108.                 "When the procedure ends, control goes back to the menu.",;
  109.                 "Note that the Esc key and the right mouse button are not active.",;
  110.                 "Typically, that's how you want them - there is a 'Quit' option.";
  111.               }
  112.  
  113. if nSel = 1
  114.     aMsg[1] += "Databases."
  115.     ADmessage( aMsg )
  116. elseif nSel = 2
  117.     aMsg[1] += "Utilities."
  118.     ADmessage( aMsg )
  119. elseif nSel = 3
  120.     ADhm_exit(e)
  121. endif
  122. return nil
  123.  
  124.  
  125. //-----------
  126. func Xdemo3()
  127. local aScn
  128. local aMenu := { "Databases", "Utilities", "Quit" }
  129. local bConfig := {|e| ADhm_extra( e,;
  130.                                   {|ee| aScn := ADsavescn( 1,0,1,79 ),;   
  131.                                         ADsay( 1,0, repl( "═", 80 ), ADhm_colors(ee)[1] );   
  132.                                   },;   
  133.                                   ,;
  134.                                   {|ee| ADrestscn( aScn )};
  135.                                 ),;
  136.                       ADhm_pulldown( e, {1,2,3} );
  137.                  }
  138. ADhormenu( aMenu,;
  139.            ,;
  140.            {;
  141.                 {|e| X3databases(e)},;
  142.                 {|e| X3utilities(e)},;
  143.                 {|e| X3quit(e)};
  144.            },;
  145.            bConfig;
  146.          )
  147. return nil
  148.  
  149. //--------------------------
  150. func X3databases( nHMEngine )
  151. local aMenu := { "Client", "Hardware", "Software" }
  152. local aProcess := {;
  153.                     {|e|ADmessage( { "Client" } )},;
  154.                     {|e|ADmessage( { "Hardware" } )},;
  155.                     {|e|ADmessage( { "Software" } )};
  156.                   }
  157. ADpulldown( nHMEngine, aMenu,, aProcess )
  158. return nil
  159.  
  160.  
  161. //--------------------------
  162. func X3utilities( nHMEngine )
  163. local aMenu := { "Reindex", "Backup", "ChangeDirectory" }
  164. local aProcess := {;
  165.                     {|e|ADmessage( { "Reindex" } )},;
  166.                     {|e|ADmessage( { "Backup" } )},;
  167.                     {|e|ADmessage( { "ChangeDirectory" } )};
  168.                   }
  169. ADpulldown( nHMEngine, aMenu,, aProcess )
  170. return nil
  171.  
  172.  
  173. //---------------------
  174. func X3quit( nHMEngine )
  175. local aMenu := { "Yes", "No" }
  176. if ADpulldown( nHMEngine, aMenu ) = 1
  177.     ADhm_exit( nHMEngine )
  178. endif
  179. return nil
  180.  
  181.  
  182. //-----------
  183. func Xintro()
  184. cls
  185. ADmessage( {;
  186.                 "The Horizontal Menu Collection of the Frankie Library",;
  187.                 "Version 1.00",;
  188.                 "A Mouseable Horizontal Menu Engine and APIs",;
  189.                 "═════════════════════════════════════════════════════",;
  190.                 "",;
  191.                 "Copyright (c) The Programmer's Desk, 1992, 1993",;
  192.                 "Press any key";
  193.            }, 7, 10, .f. )
  194. ADxwait()
  195. return nil
  196.  
  197.