home *** CD-ROM | disk | FTP | other *** search
- /* This program implements a little gadget based help facility. Simply
- * clicking on a gadget will instruct this program to pass a file name
- * to HT which will then open the file and display it.
- */
- /****************
- * D.B.G. 1990
- ****************/
-
- /* should check for failure of these calls */
- if ~Show('L', 'rexxsupport.library') then
- check = AddLib('rexxsupport.library', 10, -30, 0)
- if check = 0 then do
- say "You need the rexxsupport.library in your libs: directory."
- exit
- end
-
- if ~Show('L', 'rexxarplib.library') then
- check = AddLib('rexxarplib.library', 10, -30, 0)
- if check = 0 then do
- say "You need the rexxarplib.library and screenshare.libs in your libs: directory."
- exit
- end
-
- /*** make sure HT has been started in resident mode... */
- startht
- if rc ~== 0 then
- do
- say "couldn't start HT up....."
- exit 5
- end
-
- /* this variable and its stems define the gadget names and the
- * associated file name. Change them to suit your system.
- */
- gads.first = " Using HT "
- gads.first.fname = "df0:documentation/using"
- gads.second = " HT Docs "
- gads.second.fname = "df0:documentation/ht.doc"
- gads.third = " TechInfo "
- gads.third.fname = "df0:documentation/TechInfo"
-
- cport = 'HELP_PORT'
- notport = 'help_notify'
-
- address AREXX "'x=call CreateHost(" cport "," notport ")'"
-
- do until ShowList(P,cport)
- call Delay(10)
- end
-
- idcmp = 'CLOSEWINDOW+WINDOWDRAG+GADGETUP'
- flags = 'WINDOWCLOSE+WINDOWDRAG+BACKFILL'
- call OpenWindow(cport, 0, 0, 135, 75, idcmp, flags, 'Help Bar')
- call ActivateWindow(cport)
-
- /* make it look pretty */
- call SetReqColor(cport, BLOCKPEN, 1)
- call SetReqColor(cport, BOXPEN, 2)
- call SetReqColor(cport, SHADOWPEN, 3)
- call SetReqColor(cport, OKAYPEN, 0)
- call SetReqColor(cport, CANCELPEN, 1)
-
- call AddGadget(cport, 25, 15, "gadg1", gads.first, gads.first.fname)
- call AddGadget(cport, 28, 35, "gadg2", gads.second, gads.second.fname)
- call AddGadget(cport, 30, 55, "gadg3", gads.third, gads.third.fname)
-
- mainport = 'MP'
- mport = OpenPort(mainport)
- do until ShowList(P, mainport)
- delay(10)
- end
-
- call SetNotify(cport, GADGETUP, mainport)
- call SetNotify(cport, CLOSEWINDOW, mainport)
-
- notquit = 1
-
- do while notquit
- call WaitPkt(mainport)
- packet = GetPkt(mainport)
- if packet ~== '0000 0000'x then do
- filename = GetArg(packet, 0)
- call Reply(packet, 0)
-
- select
- when filename = 'CLOSEWINDOW' then call closeup()
- otherwise address HT LOAD filename
- end /* select */
- end /* if packet... */
- end /* do while notquit */
- exit
-
- closeup:
- call stop("HELP_PORT")
- exit
- return
-
-