home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 22 / AACD 22.iso / AACD / Programming / RxMUI / Examples / hvb.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  2001-05-24  |  4.2 KB  |  150 lines

  1. /*
  2.  * DemoHTMLview 1.0 (18.11.0)
  3.  * HTML File Viewer
  4.  * © 2000 by Robert A. Sisk
  5.  *
  6.  */
  7.  
  8. signal on Error
  9. signal on Halt
  10.  
  11. call AddLib "rmh.library",0,-30
  12. if AddLibrary("rexxsupport.library","rxmui.library")~=0 then do
  13.     call EasyRequest "Couldn't open" result,app,"Quit"
  14.     exit
  15. end
  16.  
  17. appPath = ProgramName("FULL")
  18. if RMH_AskToolType(appPath,"DebugRxMUI","key") then call RxMUIOpt "DebugMode ShowErr"
  19. sb = upper(RMH_AskToolType(appPath,"ScrollBars"))
  20.  
  21. App.Author="Robert A. Sisk"
  22. App.Base="DEMOHTMLVIEW"
  23. App.Copyright="© 2000 by Robert A. Sisk"
  24. App.Description="HTML File Viewer."
  25. App.SubWindow="mwin"
  26. App.SingleTask=1
  27. App.Title="$VER: DemoHTMLview 1.0 (18.11.0)"
  28. App.Version="DemoHTMLview"
  29.  mwin.Contents="mgroup"
  30.  mwin.ID="MAIN"
  31.  mwin.Title="DemoHTMLview"
  32.  mwin.AppWindow=1
  33.  
  34.   call child "mgroup","vg","group"
  35.    vg.Spacing=0
  36.     call child "vg","hg","group"
  37.      hg.Horiz=1
  38.      hg.Spacing=0
  39.       call child "hg","html","HTMLview"
  40.        html.Frame="Virtual"
  41.        html.NTAutoLoad=1
  42.       call child "hg","sbv","scrollbar"
  43.        sbv.ShowMe=0
  44.     call child "vg","sbh","scrollbar"
  45.      sbh.Horiz=1
  46.      sbh.ShowMe=0
  47.   call child "mgroup","gauge","gauge"
  48.    gauge.horiz=1
  49.    gauge.FixHeightTxt="n"
  50.    gauge.InfoText="Drop a HTML file over me!"
  51.   call child "mgroup",MakeObj(,"scale")
  52.  
  53. call NewObj "Application","App"
  54. if result~=0 then call RxMUIError result
  55.  
  56. call Notify "mwin","CloseRequest",1,"App","ReturnID","Quit"
  57. call Notify "html","ClickedURL","EveryTime","App","Return","call GoToURL(h.clickedURL)","TriggerAttr"
  58.  
  59. call Notify "html","height","EveryTime","App","Return","call SetScrollBars()"
  60. call Notify "html","width","EveryTime","App","Return","call SetScrollBars()"
  61. call Notify "html","parsed","EveryTime","App","Return","call parsed(h.parsed)","triggerattr"
  62.  
  63. call Notify "html","title","everytime","gauge","set","infotext","triggervalue"
  64.  
  65. call Notify "html","virtgroupwidth","everytime","sbh","set","entries","triggervalue"
  66. call Notify "html","virtgroupleft","everytime","sbh","set","first","triggervalue"
  67. call Notify "html","virtgroupheight","everytime","sbv","set","entries","triggervalue"
  68. call Notify "html","virtgrouptop","everytime","sbv","set","first","triggervalue"
  69. call Notify "html","width","everytime","sbh","set","visible","triggervalue"
  70. call Notify "html","height","everytime","sbv","nonotifyset","visible","triggervalue"
  71. call Notify "sbh","first","everytime","html","set","virtgroupleft","triggervalue"
  72. call Notify "sbv","first","everytime","html","set","virtgrouptop","triggervalue"
  73.  
  74. call AppMessage "mwin"
  75.  
  76. call set "mwin","Open",1
  77. call GetAttr "mwin","Open","WindowOpen"
  78. if ~WindowOpen then do
  79.     say "no win"
  80.     exit
  81. end
  82.  
  83. ctrl_c=2**12
  84. do forever
  85.     call NewHandle "App","h",ctrl_c
  86.     if RMH_And(h.signals,ctrl_c)>0 then exit
  87.     if h.EventFlag then
  88.         select
  89.             when h.event="QUIT" then exit
  90.             when h.event=="SetScrollBars" then call SetScrollBars
  91.             when h.event=="APPEVENT" then call appevent(h.name)
  92.             otherwise interpret h.event
  93.         end
  94. end
  95.  
  96. AppEvent:
  97. parse arg file
  98.     projectFile=file
  99.     st=StateF(projectFile)
  100.     if word(st,1)~=="FILE" then return 0
  101.     total=word(st,2)
  102.     call set("gauge","max",total)
  103.     call set("gauge","current",0)
  104.     call GoToURL "file://"projectFile
  105.     return
  106.  
  107. GoToURL:
  108.     call DoMethod "html","GoURL",arg(1)
  109.     return 1
  110.  
  111. RxMUIError:
  112.     if symbol("RxMUIError")=="LIT" then RxMUIError="?"
  113.     say app": Line" SigL", RxMUI" RxMUIError "error" arg(1)":" GetRxMUIString(arg(1))
  114.     exit
  115.  
  116. Halt:
  117.     exit
  118.  
  119. SetScrollBars:
  120.     select
  121.         when sb="NO" then return
  122.         when sb="YES" then do
  123.             rh=0
  124.             vh=1
  125.             rw=0
  126.             vw=1
  127.         end
  128.         when sb="HORIZAUTO" then do
  129.             rh=0
  130.             vh=1
  131.             call getattr("html","width","rw")
  132.             call getattr("html","virtgroupwidth","vw")
  133.         end
  134.         otherwise do
  135.             call getattr("html","width","rw")
  136.             call getattr("html","virtgroupwidth","vw")
  137.             call getattr("html","height","rh")
  138.             call getattr("html","virtgroupheight","vh")
  139.         end
  140.     end
  141.     call set("sbv","showme",rh<vh)
  142.     call set("sbh","showme",rw<vw)
  143.     return
  144.  
  145. parsed:
  146. parse arg p
  147.     if p=total then call SetScrollBars
  148.     call set("gauge","current",p)
  149.     return
  150.