home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 26 / AACD 26.iso / AACD / Programming / RxMUI / Examples / MonthNav.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  2001-09-23  |  3.0 KB  |  105 lines

  1. /**/
  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 expose global.
  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.     call RxMUIOpt("debugmode showerr")
  15.     return
  16. /***********************************************************************/
  17. HandleApp: procedure expose global.
  18.  
  19.     ctrl_c=2**12
  20.     do forever
  21.         call NewHandle("app","h",ctrl_c)
  22.         if and(h.signals,ctrl_c)>0 then exit
  23.         select
  24.             when h.event="QUIT" then exit
  25.             otherwise interpret h.event
  26.         end
  27.     end
  28.     /* never reached */
  29. /***********************************************************************/
  30. CreateApp: procedure expose global.
  31.  
  32.     app.Title="MonthNavigator"
  33.     app.Version="$VER: MonthNavigator 2.0 (10.9.2001)"
  34.     app.Copyright="©2001, alfie"
  35.     app.Author="alfie"
  36.     app.Description="MonthNavigator example"
  37.     app.Base="RXMUIEXAMPLE"
  38.     app.SubWindow="win"
  39.      win.ID="MAIN"
  40.      win.Title="MonthNavigator"
  41.      win.Contents="mgroup"
  42.  
  43.       mgroup.0="hg"
  44.        hg.class="group"
  45.        hg.horiz=1
  46.        hg.Frame="group"
  47.        hg.background="groupback"
  48.         hg.0=label("_Month")
  49.         hg.1=MakeObj("month","cycle","Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec","m")
  50.         hg.2=hspace()
  51.         hg.3=label("_Year")
  52.          year.draggable=1
  53.         hg.4=MakeObj("year","NumericButton","y",1900,2020)
  54.  
  55.       mgroup.1="mng"
  56.        mng.class="group"
  57.        mng.dropable=1
  58.        mng.draggable=1
  59.        mng.Frame="group"
  60.        mng.FrameTitle="MonthNavigator"
  61.        mng.background="groupback"
  62.         mng.0=vspace()
  63.         mng.1="mnhg"
  64.          mnhg.class="group"
  65.          mnhg.horiz=1
  66.           mnhg.0=hspace()
  67.           mnhg.1="mn"
  68.            mn.class="MonthNavigator"
  69.            mn.MNInputMode="immediate"
  70.           mnhg.2=hspace()
  71.         mng.2=vspace()
  72.  
  73.       mgroup.2=button("GetDate","_Get Date")
  74.  
  75.     if NewObj("application","app")>0 then exit
  76.  
  77.     call set("win","open",1)
  78.     if ~xget("win","open") then exit
  79.  
  80.     parse value(formatdate(,'%d %m %Y')) with d m y
  81.     call set("month","active",m-1)
  82.     call set("year","value",y)
  83.     call set('mn','day',d)
  84.  
  85.     call Notify("win","CloseRequest",1,"app","ReturnID","quit")
  86.  
  87.     call Notify("month","active","everytime","app","return","call set('mn','month',h.active+1)","triggerattr")
  88.     call Notify("year","value","everytime","mn","set","year","triggervalue")
  89.  
  90.     call Notify("GetDate","pressed","0","app","return","call GetDate")
  91.  
  92.     return
  93. /***********************************************************************/
  94. halt:
  95. break_c:
  96.     exit
  97. /**************************************************************************/
  98. GetDate: procedure
  99.     say "  Day:" xget("mn","day")
  100.     say "Month:" xget("mn","month")
  101.     say " Year:" xget("mn","year")
  102.     say
  103.     return
  104. /**************************************************************************/
  105.