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

  1. /* */
  2.  
  3. signal on halt
  4. signal on break_c
  5.  
  6. call Init
  7. call CreateApp
  8. call set("mwin","open",1)
  9. call HandleApp
  10.  
  11. /***********************************************************************/
  12. init: procedure
  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 RxMUIOpt("DebugMode ShowErr")
  16.     call SetRxMUIStack(64000)
  17.     return
  18. /***********************************************************************/
  19. CreateApp: procedure
  20.  
  21.     app.Title="Listview example"
  22.     app.Version="$VER: Listview examples 1.0 (5.12.2000)"
  23.     app.Copyright="©2000, alfie"
  24.     app.Author="alfie"
  25.     app.Description="Listview example"
  26.     app.Base="RXMUIEXAMPLE"
  27.     app.SubWindow="mwin"
  28.  
  29.      mwin.Title="Listview example"
  30.      mwin.ScreenTitle="Listview example"
  31.      mwin.ID="MWIN"
  32.      mwin.Contents="mgroup"
  33.  
  34.       mgroup.0="bg"
  35.        bg.class="group"
  36.        bg.Columns=3
  37.        bg.SameSize=1
  38.  
  39.         bg.0  = Button("selall","Select _All")
  40.         bg.1  = Button("selnone","Select _None")
  41.         bg.2  = Button("seltoggle","Select _Toggle")
  42.  
  43.         bg.3  = Button("remact","Remove Acti_ve")
  44.         bg.4  = Button("remall","Remove A_ll")
  45.         bg.5  = Button("remsel","Remove Selecte_d")
  46.  
  47.         bg.6  = Button("getall","Get _all")
  48.         bg.7  = Button("getsel","Get Sele_cted")
  49.         bg.8  = Button("sort","_Sort")
  50.  
  51.         bg.9  = Button("readd","Add _Entryes")
  52.         bg.10 = ToggleButton("showsecret","S_how Secret")
  53.         bg.11 = Text(,"RxMUI Rulezzzzz :-)")
  54.  
  55.       mgroup.1="lg"
  56.        lg.class="group"
  57.         lg.0="lview"
  58.          lview.Class="nlistview"
  59.          lview.List="list"
  60.          list.Title="First|Second|Third"
  61.           list.Format="BAR,"
  62.           list.Columns=3
  63.           list.TitleClick=2
  64.           list.MultiSelect="shifted"
  65.           list.DragSortable=1
  66.           list.DragType="immediate"
  67.           list.MincoLSortable=0
  68.           list.TitleMark=0
  69.  
  70.     res=NewObj("application","app")
  71.     if res~=0 then exit
  72.  
  73.     call notify("selall","pressed",0,"list","select","all","on")
  74.     call notify("selnone","pressed",0,"list","select","all","off")
  75.     call notify("seltoggle","pressed",0,"list","select","all","toggle")
  76.  
  77.     call notify("remall","pressed",0,"list","clear")
  78.     call notify("remact","pressed",0,"list","remove","active")
  79.     call notify("remsel","pressed",0,"list","remove","selected")
  80.  
  81.     call notify("getall","pressed",0,"app","return","call GetAll")
  82.     call notify("getsel","pressed",0,"app","return","call GetSel")
  83.  
  84.     call notify("readd","pressed",0,"app","return","call AddEntries")
  85.     call Notify("sort","pressed",0,"list","sort")
  86.     call Notify("showsecret","Selected",0,"list","set","format","BAR,")
  87.     call Notify("showsecret","Selected",1,"list","set","format","BAR,BAR,")
  88.  
  89.     call Notify("list","titleclick","everytime","list","sort2","triggervalue","add2values")
  90.     call Notify("list","sorttype","everytime","list","set","titlemark","triggervalue")
  91.  
  92.     call Notify("mwin","closerequest",1,"app","returnid","quit")
  93.  
  94.     call AddEntries
  95.  
  96.     return
  97. /***********************************************************************/
  98. HandleApp: procedure
  99.     ctrl_c=2**12
  100.     do forever
  101.         call NewHandle("app","h",ctrl_c)
  102.         if and(h.Signals,2**12)~=0 then exit
  103.         select
  104.             when h.Event="QUIT" then exit
  105.             otherwise interpret h.Event
  106.         end
  107.     end
  108. end
  109. /***********************************************************************/
  110. AddEntries: procedure
  111.  
  112.     call DoMethod("list","insert","Alfonso|Ranieri|Secret 1","bottom")
  113.     call DoMethod("list","insert","Emi|Ranieri|Secret 2","bottom")
  114.     call DoMethod("list","insert","Paolo|Ranieri|Secret 3","bottom")
  115.     call DoMethod("list","insert","Tiziana|Spognardi|Secret 4","bottom")
  116.     return
  117. /***********************************************************************/
  118. GetAll: procedure
  119.  
  120.     call DoMethod("list","GetEntries","A")
  121.     if a.num>0 then
  122.         do i=0 to a.num-1
  123.             say i":" a.i
  124.         end
  125.     else say "No entries"
  126.     say
  127.     return
  128. /***********************************************************************/
  129. GetSel: procedure
  130.  
  131.     call DoMethod("list","GetSelected","a")
  132.     if a.num>0 then
  133.         do i=0 to a.num-1
  134.             call DoMethod("list","GetEntry",i,"e")
  135.             say i":" e
  136.         end
  137.     else say "No entries"
  138.     say
  139.     return
  140. /***********************************************************************/
  141. halt:
  142. break_c:
  143.     exit
  144. /***********************************************************************/
  145.