home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 109 / EnigmaAmiga109CD.iso / software / sviluppo / rxmui / examples / manuald&d.rexx < prev    next >
OS/2 REXX Batch file  |  1999-12-21  |  4KB  |  155 lines

  1. /*how to handle a manual d and d between 2 NList*/
  2.  
  3.  
  4. signal on halt
  5. signal on break_c
  6.  
  7. l="rmh.library";if ~show("L",l) then;if ~addlib(l,0,-30) then exit
  8. if AddLibrary("rxmui.library")~=0 then exit
  9. call setrxmuistack(86000) /* big stack for nlist */
  10.  
  11. call createApp
  12.  
  13. call set("win","open",1)
  14. call getattr("win","open","o")
  15. if o=0 then do
  16.     say "can't open window"
  17.     exit
  18. end
  19.  
  20. call handleApp
  21. exit
  22. /***********************************************************************/
  23. handleApp: procedure
  24. ctrl_c=2**12
  25. s=0
  26. do forever
  27.     ws=1
  28.     call handle("APP","H",s)
  29.     do i=0 to h.num-1
  30.         select
  31.             when h.i="QUIT" then exit
  32.             when h.i="DROPEVENT" then do
  33.                 call dropFun(h.i.from,h.i.to)
  34.                 ws=0
  35.             end
  36.             otherwise say h.num-1 h.i
  37.         end
  38.     end
  39.     if ~ws then iterate
  40.     s=wait(or(h.signals,ctrl_c))
  41.     if and(s,ctrl_c)~=0 then exit
  42. end
  43. * never reached */
  44. /***********************************************************************/
  45. err: procedure expose sigl rxmuierror
  46. parse arg res
  47. say signl "["res"]"
  48.     say getrxmuistring(res) "in line" sigl-1 rxmuierror
  49.     exit
  50. /***********************************************************************/
  51. createApp: procedure
  52.     app.Title="ManualD&D"
  53.     app.Version="$VER: ManualD&D 1.0 (22.11.99)"
  54.     app.Copyright="©1999, alfie"
  55.     app.Author="alfie"
  56.     app.Description="ManualD&D example"
  57.     app.Base="SHOW"
  58.     app.SubWindow="WIN"
  59.  
  60.      win.Title="ManualD&D"
  61.      win.ScreenTitle="ManualD&D"
  62.      win.ID="SHOW"
  63.      win.Contents="mgroup"
  64.  
  65.       mgroup.0="bg"
  66.        bg.class="group"
  67.        bg.horiz=1
  68.        bg.0 = Button("remove","_Remove")
  69.        bg.1 = Button("sort","_Sort")
  70.       mgroup.1="g"
  71.        g.class="group"
  72.        g.horiz=1
  73.        g.0="listview1"
  74.         listview1.class="nlistview"
  75.         listview1.list="list1"
  76.          list1.title="Uno|Due"
  77.          list1.titleclick=2
  78.          list1.multiselect="shifted"
  79.          list1.dragsortable=1
  80.          list1.dragtype="immediate"
  81.          list1.Format="BAR W=-1,BAR W=-1"
  82.          list1.mincolsortable=0
  83.          list1.titlemark=0
  84.           list1.0="Uno|1"
  85.           list1.1="Due|2"
  86.           list1.2="Tre|3"
  87.        g.1="listview2"
  88.         listview2.class="nlistview"
  89.         listview2.list="list2"
  90.          list2.dragsortable=1
  91.          list2.dragtype="immediate"
  92.          list2.Format="COL=1 BAR,COL=0 BAR"
  93.          list2.multiselect="DEFAULT"
  94.          list2.dragsortinsert=1
  95.           list2.0="Alfonso|Ranieri"
  96.           list2.1="Franco|Fiocca"
  97.           list2.2="Tiziana|Spognardi"
  98.           list2.3="Angelo|Barone"
  99.  
  100.     res=NewObj("application","app")
  101.     if res~=0 then call err(res)
  102.  
  103.     res=DandD("list2","list1")
  104.     if res~=0 then call err(res)
  105.  
  106.     res=DandD("list1","list2")
  107.     if res~=0 then call err(res)
  108.  
  109.     res=Notify("sort","pressed",0,"list2","sort")
  110.     if res~=0 then call err(res)
  111.  
  112.     res=Notify("remove","pressed",0,"list1","remove","active")
  113.     if res~=0 then call err(res)
  114.  
  115.     res=Notify("list1","titleclick","everytime","list1","sort2","triggervalue","add2values")
  116.     if res~=0 then call err(res)
  117.  
  118.     res=Notify("list1","sorttype","everytime","list1","set","titlemark","triggervalue")
  119.     if res~=0 then call err(res)
  120.  
  121.     res=Notify("list1","active","everytime","app","returnid")
  122.     if res~=0 then call err(res)
  123.  
  124.     res=Notify("win","closerequest",1,"app","returnid","quit")
  125.     if res~=0 then call err(res)
  126.  
  127.     return
  128. /***********************************************************************/
  129. halt:
  130. break_c:
  131.     exit
  132. /**************************************************************************/
  133. /* this is a drag and drop between 2 NList view */
  134. dropFun: procedure
  135. parse arg from,to
  136.     call DoMethod(from,"GETSELECTED","SEL")
  137.     call getattr(to,"dragsortable","DS")
  138.     if ds then
  139.         do i=0 to sel.num-1
  140.             call doMethod(from,"getentry",sel.i,"E")
  141.             call DoMethod(to,"insert",e,"sorted")
  142.         end
  143.     else do
  144.         call getattr(to,"dropmark","DM")
  145.         do i=0 to sel.num-1
  146.             call doMethod(from,"getentry",sel.i,"E")
  147.             call DoMethod(to,"insert",e,dm)
  148.         end
  149.         call getattr(to,"insertposition","DM")
  150.         call set(to,"active",dm)
  151.     end
  152.     call DoMethod(from,"remove","selected")
  153.     return
  154. /**************************************************************************/
  155.