home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 504a.lha / hypertext / Rexx / help.rexx < prev    next >
OS/2 REXX Batch file  |  1991-05-01  |  3KB  |  98 lines

  1. /*    This program implements a little gadget based help facility.  Simply
  2.  * clicking on a gadget will instruct this program to pass a file name
  3.  * to HT which will then open the file and display it.
  4.  */
  5. /****************
  6.  * D.B.G. 1990
  7.  ****************/
  8.  
  9.  /* should check for failure of these calls */
  10.  if ~Show('L', 'rexxsupport.library') then
  11.   check = AddLib('rexxsupport.library', 10, -30, 0)
  12.  if check = 0 then do
  13.    say "You need the rexxsupport.library in your libs: directory."
  14.    exit
  15.   end
  16.  
  17.  if ~Show('L', 'rexxarplib.library') then
  18.   check = AddLib('rexxarplib.library', 10, -30, 0)
  19.  if check = 0 then do
  20.    say "You need the rexxarplib.library and screenshare.libs in your libs: directory."
  21.    exit
  22.   end
  23.  
  24.  /*** make sure HT has been started in resident mode... */
  25.  startht
  26.  if rc ~== 0  then
  27.   do
  28.    say "couldn't start HT up....."
  29.    exit 5
  30.   end
  31.  
  32.  /* this variable and its stems define the gadget names and the
  33.   * associated file name.  Change them to suit your system.
  34.   */
  35.  gads.first = " Using HT "
  36.  gads.first.fname = "df0:documentation/using"
  37.  gads.second = " HT Docs "
  38.  gads.second.fname = "df0:documentation/ht.doc"
  39.  gads.third = " TechInfo "
  40.  gads.third.fname = "df0:documentation/TechInfo"
  41.  
  42.  cport = 'HELP_PORT'
  43.  notport = 'help_notify'
  44.  
  45.  address AREXX "'x=call CreateHost(" cport "," notport ")'"
  46.  
  47.  do until ShowList(P,cport)
  48.    call Delay(10)
  49.   end
  50.  
  51.  idcmp = 'CLOSEWINDOW+WINDOWDRAG+GADGETUP'
  52.  flags = 'WINDOWCLOSE+WINDOWDRAG+BACKFILL'
  53.  call OpenWindow(cport, 0, 0, 135, 75, idcmp, flags, 'Help Bar')
  54.  call ActivateWindow(cport)
  55.  
  56.  /* make it look pretty */
  57.  call SetReqColor(cport, BLOCKPEN, 1)
  58.  call SetReqColor(cport, BOXPEN, 2)
  59.  call SetReqColor(cport, SHADOWPEN, 3)
  60.  call SetReqColor(cport, OKAYPEN, 0)
  61.  call SetReqColor(cport, CANCELPEN, 1)
  62.  
  63.  call AddGadget(cport, 25, 15, "gadg1", gads.first, gads.first.fname)
  64.  call AddGadget(cport, 28, 35, "gadg2", gads.second, gads.second.fname)
  65.  call AddGadget(cport, 30, 55, "gadg3", gads.third, gads.third.fname)
  66.  
  67.  mainport = 'MP'
  68.  mport = OpenPort(mainport)
  69.  do until ShowList(P, mainport)
  70.    delay(10)
  71.   end
  72.  
  73.  call SetNotify(cport, GADGETUP, mainport)
  74.  call SetNotify(cport, CLOSEWINDOW, mainport)
  75.  
  76.  notquit = 1
  77.  
  78.  do while notquit
  79.     call WaitPkt(mainport)
  80.     packet = GetPkt(mainport)
  81.     if packet ~== '0000 0000'x then do
  82.       filename = GetArg(packet, 0)
  83.       call Reply(packet, 0)
  84.  
  85.       select
  86.     when filename = 'CLOSEWINDOW' then call closeup()
  87.     otherwise address HT LOAD filename
  88.       end                 /* select */
  89.      end                 /* if packet... */
  90.  end                     /* do while notquit */
  91. exit
  92.  
  93. closeup:
  94.  call stop("HELP_PORT")
  95.  exit
  96. return
  97.  
  98.