home *** CD-ROM | disk | FTP | other *** search
/ A.C.E. 1 / ACE CD 1.iso / files / utils / acroarex.dms / in.adf / Examples / fastmenu.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1994-06-09  |  2.9 KB  |  89 lines

  1. /* fastmenu.rexx */
  2. /* this opens a window with buttons which run macros */
  3. /* Marvin Weinstein, 1989 */
  4.  
  5. if ~show('L','rexxsupport.library') then
  6.    call addlib('rexxsupport.library',0,-30)
  7. if ~show('L','rexxarplib.library') then
  8.    call addlib('rexxarplib.library',0,-30)
  9. if ~show('L','rexxmathlib.library') then
  10.    call addlib('rexxmathlib.library',0,-30)
  11.  
  12. /*
  13.  * Make sure the libraries are in memory ... not needed if the library
  14.  * files have been copied to LIBS:.
  15.  */
  16. address command ':c/loadlib :libs/rexxsupport.library'
  17. if ~showlist('L','rexxarplib.library') then do
  18.    say "Loading RexxArpLib Library ..."
  19.    address command ':c/loadlib :libraries/rexxarplib/screenshare.library'
  20.    address command ':c/loadlib :libraries/rexxarplib/rexxarplib.library'
  21.    end
  22. if ~showlist('L','rexxmathlib.library') then do
  23.    say "Loading RexxMathLib Library ..."
  24.    address command ':c/loadlib :libraries/rexxmathlib/rexxmathlib.library'
  25.    end
  26.  
  27.    call MenuWindow(FASTHOST,FASTPORT)
  28.    call AddMenu(FASTHOST,"Basic Commands")
  29.    call AddItem(FASTHOST,"Quit","quit",Q)
  30.  
  31.    call AddGadget(FASTHOST,6,11 ,"BOFA" ," New CLI     ",      /* + */,
  32.       "'address command newcli'")
  33.    call AddGadget(FASTHOST,6,22 ,"EDIT" ," Edit        ",      /* + */,
  34.       "'address command e'")
  35.    call AddGadget(FASTHOST,6,33 ,"CAL"  ," Calendar    ",      /* + */,
  36.       "arexx_disk:examples/month")
  37.    call AddGadget(FASTHOST,6,44 ,"CLEAR"," Clear       ","'call postmsg'")
  38.    callsin = " 'call ''ARexx_Disk:examples/graph''(''sin(x)'',
  39.       25,0.00,6.28,''5.0 * sin(x)'')' "
  40.    call AddGadget(FASTHOST,6,55 ,"SINX" ," Show Sin(x) ",callsin)
  41.    calllog = " 'call ''ARexx_Disk:examples/graph''(''log(x)'',
  42.       25,0.01,5.00,''45. * log(x)'')' "
  43.    call AddGadget(FASTHOST,6,66 ,"LOGX" ," Show Log(x) ",calllog)
  44.    callabout = "'call postmsg 0,0,''This is a configurable ""fast menu""'''"
  45.  
  46.    call SetNotify(FASTHOST,GADGETUP,REXX)
  47.    call SetNotify(FASTHOST,CLOSEWINDOW,FASTHOST)
  48.    call SetNotify(FASTHOST,MENUPICK,FASTHOST)
  49.  
  50. exit
  51.  
  52. /* MenuWindow.rexx - menu making function */
  53.  
  54. MenuWindow:
  55. arg menuhost, menuport
  56.  
  57. parse version 'V' vers .
  58. if vers > 1.06
  59.    then address AREXX  "'x=createhost(" menuhost "," menuport ")'"
  60.    else "runwsh >nil:" "'x=createhost(" menuhost "," menuport ")'"
  61.  
  62. mp = openport(menuport)
  63. do for 10/(10/50) while ~showlist('p',menuhost)
  64.    call delay 10
  65. end
  66.  
  67. if ~(mp & showlist('p',menuhost)) then
  68.    return
  69.  
  70. idcmp = 'CLOSEWINDOW+GADGETUP+MENUPICK'
  71. flags = 'WINDOWCLOSE+WINDOWDRAG+WINDOWDEPTH'
  72.  
  73.    call SetReqColor(menuhost,OKAY,1)
  74. /* call SetReqColor(menuhost,BACK,1) */
  75.    call SetReqColor(menuhost,SHADOW,0)
  76.    call SetReqColor(menuhost,BLOCK,1)
  77.    call SetReqColor(menuhost,BOX,1)
  78.  
  79.    wd = 120;ht = 6*11+11
  80.    /* Open the menu window in the lower right-hand corner */
  81.    call OpenWindow(menuhost,screencols()-wd,screenrows()-ht,wd,ht, /* */,
  82.                    idcmp, flags)
  83.    call SetAPen(menuhost,1)
  84.    call SetBPen(menuhost,1)
  85.    call SetDrMd(menuhost,JAM2)
  86.  
  87.  
  88. return 0
  89.