home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Amiga 12 / MA_Cover_12.iso / libs / rxwiz / examples / helpdemo.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1999-05-24  |  3.0 KB  |  110 lines

  1. /* Shows how to handle gadget help */
  2.  
  3. signal on halt
  4. signal on break_c
  5.  
  6. l="rmh.library";if ~show("L",l) then;if ~addlib(l,0,-30) then exit
  7. if AddLibrary("rexxsupport.library","rxwiz.library")~=0 then exit
  8.  
  9. prg=ProgramName("NOEXT")
  10. path=PathPart(ProgramName("FULL"))
  11.  
  12. parm.0.value=""
  13. if ~RMH_ReadArgs("PUBSCREEN") then do
  14.     call PrintFault(IoErr(),prg)
  15.     exit
  16. end
  17.  
  18. s.PubScreen=parm.0.value
  19. s.fallback=1
  20. s.Snapshot=1
  21. s.cat=prg".catalog"
  22. s.AppName=prg
  23. s.AppIconName=prg
  24. s.CxTitle=prg
  25. s.CxDescr="Shows how to handle gadget help"
  26. s.MasterWin="GHWIN"
  27. s.AutoClose=1
  28. s.catalog=prg".catalog"
  29. res=OpenSurface(AddPart(path,prg".wizard"),"S")
  30. if res~=0 then call error(res)
  31. ss=SurfaceSignal("S")
  32.  
  33. GHWIN.Gads=16
  34. res=OpenWindow("S","GHWIN")
  35. if res~=0 then call error(res)
  36.  
  37. global.help=0
  38. ctrl_c=2**12
  39. stop=0
  40. do while ~stop
  41.     srec=Wait(or(ss,ctrl_c))
  42.     if and(srec,ctrl_c)>0 then call break_c
  43.     if and(srec,ss)>0 then stop=handle("GHWIN")
  44. end
  45. call CloseSurface("S")
  46. exit
  47.  
  48. /**************************************************************************/
  49. error:
  50. parse arg code
  51.     if RXWIZERR~="RXWIZERR" then string = GetRxWizString(1001)":" RXWIZERR || d2c(10)
  52.     else string=""
  53.     string= string || GetRxWizString(code) || d2c(10) || GetRxWizString(1002)":" SIGL-1
  54.     call easyrequest(string,"RXWiz")
  55.     exit
  56. /**************************************************************************/
  57. handle: procedure expose global.
  58. parse arg o
  59.     handle.wait=0
  60.     res=HandleSurface("S","HANDLE")
  61.     if res~=0 then call error(res)
  62.     do i=0 to handle.imsg-1
  63.         select
  64.             when handle.i.class="CLOSEWINDOW" then return 1
  65.             when handle.i.class="VANILLAKEY" then call GadgetKey("S",handle.i.window,handle.i.code,handle.i.qualifier)
  66.             when handle.i.class="MENUPICK" then
  67.                 select
  68.                     when handle.i.objectid="MABOUT" then call WizEasyRequest("S","GHWIN",1)
  69.                     when handle.i.objectid="MHIDE" then call IconifySurface("S",1)
  70.                     when handle.i.objectid="MQUIT" then return 1
  71.                     when handle.i.objectid="MHELP" then do
  72.                         global.help=~global.help
  73.                         call HelpControl("S",handle.i.window,global.help)
  74.                     end
  75.                     otherwise nop
  76.                 end
  77.             when handle.i.class="IDCMPUPDATE" then
  78.                 select
  79.                     when handle.i.objectid="CHECK" then do
  80.                         call LockWindow("S","GHWIN")
  81.                         call info "Now I should check our mail box..."
  82.                         call delay(50)
  83.                         call info "But I am just a demo :-)"
  84.                         call delay(50)
  85.                         call UnLockWindow("S","GHWIN")
  86.                     end
  87.                     when handle.i.objectid="CANCEL" then return 1
  88.                     otherwise nop
  89.                 end
  90.             when handle.i.class="GADGETHELP" then
  91.                 if handle.i.help~="" then call info handle.i.help
  92.                 else if handle.i.objectid~="" then call info handle.i.objectid
  93.                      else call info ""
  94.             otherwise say handle.i.class
  95.         end
  96.     end
  97.     return 0
  98. /**************************************************************************/
  99. info: procedure
  100. parse arg msg
  101.     set.text=msg
  102.     call SetWizAttrs("S","GHWIN","INFO","SET")
  103.     return
  104. /**************************************************************************/
  105. halt:
  106.     exit
  107. break_c:
  108.     exit
  109. /**************************************************************************/
  110.