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

  1. /*
  2.     HM_DEMO3.PRG
  3.  
  4.     Demonstration of a pulldown menu.  It also demonstrates the use of the
  5.     following APIs:
  6.  
  7.     ADhm_extra() - designates codeblocks to be EVALuated just before
  8.         displaying the menu, right after displaying the menu, and just
  9.         before exiting.
  10.  
  11.     ADhm_pulldown() - specifies which menu options are to be automatically
  12.         pulled down when they get highlighted.
  13.  
  14.     ADhm_exit() - instructs the engine to terminate.
  15.  
  16.     ADpulldown() - implements a pulldown vertical menu off the horizontal
  17.         menu
  18. */
  19.  
  20.  
  21. //---------
  22. func main()
  23. local aScn
  24. local aMenu := { "Databases", "Utilities", "Quit" }
  25. local bConfig := {|e| ADhm_extra( e,;
  26.                                   {|ee| aScn := ADsavescn( 1,0,1,79 ),;   
  27.                                         ADsay( 1,0, repl( "═", 80 ), ADhm_colors(ee)[1] );   
  28.                                   },;   
  29.                                   ,;
  30.                                   {|ee| ADrestscn( aScn )};
  31.                                 ),;
  32.                       ADhm_pulldown( e, {1,2,3} );
  33.                  }
  34. ADhormenu( aMenu,;
  35.            ,;
  36.            {;
  37.                 {|e| X3databases(e)},;
  38.                 {|e| X3utilities(e)},;
  39.                 {|e| X3quit(e)};
  40.            },;
  41.            bConfig;
  42.          )
  43. return nil
  44.  
  45. //--------------------------
  46. func X3databases( nHMEngine )
  47. local aMenu := { "Client", "Hardware", "Software" }
  48. local aProcess := {;
  49.                     {|e|ADmessage( { "Client" } )},;
  50.                     {|e|ADmessage( { "Hardware" } )},;
  51.                     {|e|ADmessage( { "Software" } )};
  52.                   }
  53. ADpulldown( nHMEngine, aMenu,, aProcess )
  54. return nil
  55.  
  56.  
  57. //--------------------------
  58. func X3utilities( nHMEngine )
  59. local aMenu := { "Reindex", "Backup", "ChangeDirectory" }
  60. local aProcess := {;
  61.                     {|e|ADmessage( { "Reindex" } )},;
  62.                     {|e|ADmessage( { "Backup" } )},;
  63.                     {|e|ADmessage( { "ChangeDirectory" } )};
  64.                   }
  65. ADpulldown( nHMEngine, aMenu,, aProcess )
  66. return nil
  67.  
  68.  
  69. //---------------------
  70. func X3quit( nHMEngine )
  71. local aMenu := { "Yes", "No" }
  72. if ADpulldown( nHMEngine, aMenu ) = 1
  73.     ADhm_exit( nHMEngine )
  74. endif
  75. return nil
  76.  
  77.  
  78.