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

  1. /**/
  2.  
  3. signal on halt
  4. signal on break_c
  5.  
  6. call Init()
  7. call CreateApp(f)
  8. call HandleApp
  9. /* never reached */
  10.  
  11. /***********************************************************************/
  12. Init: procedure expose global.
  13.     l="rmh.library";if ~show("L",l) then;if ~addlib(l,0,-30) then exit
  14.     if AddLibrary("rxmui.library")~=0 then exit
  15.     call MacroEnv("global","ProgDir CD")
  16.     call SetRxMUIStack(16384)
  17.     global.noti=StartNotify("CLIP",0)
  18.     if global.noti<0 then do
  19.         call PrintFault(IoErr(),ProgramName("NOEXT"))
  20.         exit
  21.     end
  22.     global.ns=NotifySignal(global.noti)
  23.     global.bm=0
  24.     if NewObj("rectangle","bm")>0 then exit
  25.     return
  26. /***********************************************************************/
  27. CreateApp: procedure expose global.
  28.  
  29.     call RxMUIOpt("debugmode showerr")
  30.  
  31.     app.Title="Clipview"
  32.     app.Version="$VER: Clipview 1.0 (12.3.2001)"
  33.     app.Copyright="Copyright 2001 by alfie"
  34.     app.Author="alfie"
  35.     app.Description="Clipview example"
  36.     app.Base="RXMUIEXAMPLE"
  37.     app.SubWindow="win"
  38.  
  39.      win.ID="main"
  40.      win.Title="Clipview"
  41.      win.UseBottomBorderScroller=1
  42.      win.UseRightBorderScroller=1
  43.      win.Contents="mgroup"
  44.  
  45.       mgroup.0="sg"
  46.        sg.class="scrollgroup"
  47.        sg.UseWinBorder=1
  48.        sg.frame="virtual"
  49.        sg.virtgroupcontents="vg"
  50.         vg.class="virtgroup"
  51.  
  52.     if NewObj("APPLICATION","APP")>0 then exit
  53.  
  54.     call RxMUIOpt("")
  55.  
  56.     call CreateClipObject()
  57.  
  58.     call set("win","open",1)
  59.     if ~xget("win","open") then exit
  60.  
  61.     call Notify("win","CloseRequest",1,"app","ReturnID","quit")
  62.  
  63.     return
  64. /***********************************************************************/
  65. HandleApp: procedure expose global.
  66.  
  67.     ctrl_c=2**12
  68.     mask=or(ctrl_c,global.ns)
  69.     do forever
  70.  
  71.         call NewHandle("app","h",mask)
  72.  
  73.         if and(h.signals,ctrl_c)>0 then exit
  74.         if and(h.signals,global.ns)>0 then call CreateClipObject()
  75.         if h.EventFlag then
  76.             select
  77.                 when h.event="QUIT" then exit
  78.                 otherwise interpret h.event
  79.             end
  80.  
  81.     end
  82.     /* never reached */
  83. /***********************************************************************/
  84. CreateClipObject: procedure expose global.
  85.  
  86.     call set("app","sleep",1)
  87.  
  88.     call DoMethod("vg","InitChanges")
  89.     if global.bm then call Dispose("chg")
  90.  
  91.     bm.sourcetype="Clipboard"
  92.     bm.source=0
  93.     if NewObj("picture","bm")>0 then do
  94.         if ReadTextClip("t")>0 then do
  95.             drop bm.
  96.             bm.contents=t
  97.             if NewObj("text","bm")>0 then exit
  98.             t="text"
  99.         end
  100.         else t="none"
  101.     end
  102.     else t="picture"
  103.  
  104.     chg.horiz=1
  105.     chg.spacing=0
  106.      chg.0="cvg"
  107.       cvg.class="group"
  108.       cvg.spacing=0
  109.        cvg.0="bm"
  110.        cvg.1=vspace()
  111.      chg.1=hspace()
  112.     if NewObj("group","chg")>0 then exit
  113.  
  114.     global.bm=1
  115.  
  116.     call Add("vg","chg")
  117.     call DoMethod("vg","ExitChanges")
  118.     call set("win","Title","Clipview ["t"]")
  119.     call set("app","sleep",0)
  120.     return
  121. /***********************************************************************/
  122. halt:
  123. break_c:
  124.     exit
  125. /**************************************************************************/
  126.