home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 19 / AACD19.BIN / AACD / Programming / rxmui / examples / virtual.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  2001-01-29  |  6.3 KB  |  230 lines

  1. /* virtual.rexx 1.0 (20.7.2000) */
  2.  
  3. signal on halt
  4. signal on break_c
  5.  
  6. call init
  7. call CreateApp
  8. call HandleApp
  9. /* never reached */
  10. /***********************************************************************/
  11. init: procedure
  12.     l="rmh.library";if ~show("L",l) then;if ~AddLib(l,0,-30) then exit
  13.     if AddLibrary("rxmui.library")~=0 then exit
  14.     return
  15. /***********************************************************************/
  16. MakePage1: procedure
  17.  
  18.     text1=ParseText("
  19. %iHello User !%n\n
  20. \n
  21. This could be a very long text and you are looking\n
  22. at it through a %uvirtual group%n. Please use the\n
  23. scrollbars at the right and bottom of the group to\n
  24. move the visible area either vertically or\n
  25. horizontally. While holding down the small arrow\n
  26. button between both scrollbars, the display will\n
  27. follow your mouse moves.\n
  28. \n
  29. If you click somewhere into a %uvirtual group%n and\n
  30. move the mouse across one of its borders, the group will\n
  31. start scrolling. If you are lucky and own a middle mouse\n
  32. button, you may also want to press it and try moving.\n
  33. \n
  34. When the surrounding window is big enough for the\n
  35. complete virtual group to fit, the scrollers and\n
  36. the move button get disabled.\n
  37. \n
  38. Since this %uvirtual group%n does only contain a\n
  39. single text object, it's a rather simple example.\n
  40. In fact, virtual groups are a lot more powerful,\n
  41. they can contain any objects you like.\n
  42. \n
  43. Note to 7MHz/68000 users: Sorry if you find this\n
  44. thingy a bit slow. Clipping in virtual groups can\n
  45. get quite complicated. Please don't blame me,\n
  46. blame your 'out of date' machine! :-)\n
  47. \n
  48. %i%cHave fun, Stefan.%n%l\n
  49. \n
  50. %uNote From %ialfie%n:\n
  51. in %bRxMUI%n version < 2.4, a virtual group with a\n
  52. frame shows its frame twice.\n")
  53.  
  54.     v.frame="virtual"
  55.     v.UseWinBorder=1
  56.      v.0="t0"
  57.       t0.class="text"
  58.       t0.background="textback"
  59.       t0.contents=text1
  60.  
  61.     res=NewObj("scrollgroup","page1","v")
  62.     if res~=0 then call err(res)
  63.  
  64.     return "page1"
  65. /***********************************************************************/
  66. MakePage2: procedure
  67.  
  68.     text2=ParseText("
  69. %cAs you can see, this virtual group contains a\n
  70. lot of different objects. The (virtual) width\n
  71. and height of the virtual group are automatically\n
  72. calculated from the default width and height of\n
  73. the virtual groups contents.")
  74.  
  75.     v.frame="virtual"
  76.  
  77.      v.0="t1"
  78.       t1.class="text"
  79.       t1.frame="text"
  80.       t1.background="textback"
  81.       t1.contents=text2
  82.  
  83.      v.1="g0"
  84.       g0.class="group"
  85.       g0.horiz=1
  86.        g0.0="g1"
  87.         g1.class="group"
  88.         g1.columns=2
  89.         g1.frame="group"
  90.         g1.FrameTitle="Images"
  91.         do i=0 to 9
  92.          g1.i="im"i;
  93.           interpret "IM"i".CLASS=image"
  94.           interpret 'IM'i'.SPEC='i+11
  95.         end
  96.        g0.1="g2"
  97.         g2.class="group"
  98.         g2.frame="group"
  99.         g2.FrameTitle="Backgrounds"
  100.          g2.0="g3"
  101.           g3.class="group"
  102.           g3.horiz=1
  103.            g3.0="rec0"
  104.             rec0.class="rectangle"
  105.             rec0.frame="text"
  106.             rec0.background="background"
  107.             rec0.FixWidth=30
  108.            g3.1="rec1"
  109.             rec1.class="rectangle"
  110.             rec1.frame="text"
  111.             rec1.background="fill"
  112.             rec1.FixWidth=30
  113.            g3.2="rec2"
  114.             rec2.class="rectangle"
  115.             rec2.frame="text"
  116.             rec2.background="shadow"
  117.             rec2.FixWidth=30
  118.          g2.1="g4"
  119.           g4.class="group"
  120.           g4.horiz=1
  121.            g4.0="rec3"
  122.             rec3.class="rectangle"
  123.             rec3.frame="text"
  124.             rec3.background="shadowback"
  125.             rec3.FixWidth=30
  126.            g4.1="rec4"
  127.             rec4.class="rectangle"
  128.             rec4.frame="text"
  129.             rec4.background="shadowfill"
  130.             rec4.FixWidth=30
  131.            g4.2="rec5"
  132.             rec5.class="rectangle"
  133.             rec5.frame="text"
  134.             rec5.background="shadowshine"
  135.             rec5.FixWidth=30
  136.          g2.2="g5"
  137.           g5.class="group"
  138.           g5.horiz=1
  139.            g5.0="rec6"
  140.             rec6.class="rectangle"
  141.             rec6.frame="text"
  142.             rec6.background="fillback"
  143.             rec6.FixWidth=30
  144.            g5.1="rec7"
  145.             rec7.class="rectangle"
  146.             rec7.frame="text"
  147.             rec7.background="shineback"
  148.             rec7.FixWidth=30
  149.            g5.2="rec8"
  150.             rec8.class="rectangle"
  151.             rec8.frame="text"
  152.             rec8.background="fillshine"
  153.             rec8.FixWidth=30
  154.  
  155.      v.2="g6"
  156.       g6.class="group"
  157.       g6.frame="group"
  158.       g6.columns=2
  159.        g6.0=label("Gauge")
  160.        g6.1="gauge"
  161.         gauge.class="gauge"
  162.         gauge.frame="gauge"
  163.         gauge.horiz=1
  164.         gauge.current=66
  165.        g6.2=VSpace(0)
  166.        g6.3=MakeObj(,"scale")
  167.  
  168.     res=NewObj("scrollgroup","page2","v")
  169.     if res~=0 then call err(res)
  170.  
  171.     return "page2"
  172. /***********************************************************************/
  173. HandleApp: procedure  expose global.
  174.     ctrl_c=2**12
  175.     do forever
  176.         call NewHandle("APP","H",ctrl_c)
  177.         if and(h.signals,ctrl_c)>0 then exit
  178.         select
  179.             when h.event="QUIT" then exit
  180.             otherwise nop
  181.         end
  182.     end
  183. /***********************************************************************/
  184. CreateApp: procedure expose global.
  185.  
  186.     app.title="VirtualDemo"
  187.     app.version="$VER: VirtualDemo 1.0 (20.7.2000)"
  188.     app.copyright="©2000, alfie"
  189.     app.author="alfie"
  190.     app.description="Show virtual groups."
  191.     app.base="VIRTUALDEMO"
  192.     app.SubWindow="mwin"
  193.  
  194.      mwin.title="Virtual Groups"
  195.      mwin.ID="VIRT"
  196.      mwin.UseRightBorderScroller=1
  197.      mwin.UseBottomBorderScroller=1
  198.      mwin.contents="mgroup"
  199.  
  200.       mgroup.class="register"
  201.       mgroup.Titles="Page1|Page2"
  202.        mgroup.0=MakePage1()
  203.        mgroup.1=MakePage2()
  204.  
  205.     res=NewObj("application","app")
  206.     if res~=0 then call err(res)
  207.  
  208.     call notify("mwin","CloseRequest",1,"app","ReturnID","quit")
  209.  
  210.     call set("mwin","open",1)
  211.     call getattr("mwin","open","o")
  212.     if o=0 then do
  213.         say "can't open window"
  214.         exit
  215.     end
  216.  
  217.     return
  218. /***********************************************************************/
  219. halt:
  220. break_c:
  221.     exit
  222. /**************************************************************************/
  223. err: procedure expose sigl RxMUIError
  224. parse arg res
  225.     msg = ProgramName()":" GetRxMUIString(res) "in line" sigl-1
  226.     if RxMUIError~="RXMUIERROR" then msg = msg "["RxMUIError"]"
  227.     say msg
  228.     exit
  229. /**************************************************************************/
  230.