Post Reply 
How Drawmenu work's?
01-25-2017, 05:06 PM
Post: #18
RE: How Drawmenu work's?
Hi,

In this context, I reproduce a part of program that show us writting good
soft boutons with a second level of soft boutons. It is a way to use a "NEXT" "PREV" bouton as on HP 50 for exemple.

Reproduced with permission.

Code:


 EXPORT DTM1()
BEGIN
// DFX Main Menu
// WMWK 2014-09-19

  LOCAL m,m1,mx,my,N→Ja,dd1,dd2,dp1;
  LOCAL dp2, doey;
  LOCAL dhh,dmm,dss,dmm1;
  LOCAL stime, stx, timstr,timstr2;
  LOCAL xhh,xmm,xss;
  LOCAL m,m1,mx,my;
  LOCAL changed, newtime;
  LOCAL chos;

  While Z ≠ 9999 DO
    WHILE MOUSE(1)≥0 DO END;
    RECT();
    TEXTOUT_P("Date & time functions for Hp Prime V 0.99a",60,1,2);
      DRAWMENU("N→J","Δdays","date+","doe","time","exit");
    REPEAT
       m:=MOUSE;
       m1:=m(1);
    UNTIL SIZE(m1)>0;
    mx:=m1(1);
    my:=m1(2);

    IF my≥220 AND my≤239 THEN

      IF mx≥0 AND mx≤51 THEN   // Button 1
        N→Ja:=0;
        INPUT (N→Ja,"Number date to Julian Date number","dd.mmyyyy =", "Enter number date");
        TEXTOUT_P("JDN = ",32,51,3);
        TEXTOUT_P(N→J(N→Ja),89,51,3);
        WAIT(-1);
      END;

      IF mx≥53 AND mx≤104 THEN   // Button 2
        dd1:=0;dd2:=0;
        INPUT ({dd1,dd2}, "Difference between two dates in days",{"1st Date","2nd Date"}, {"dd.mmyyyy =", 

"dd.mmyyyy ="});
        TEXTOUT_P("ΔDAYS: ",5,81,3);
        TEXTOUT_P(N→J(dd2)-N→J(dd1),65,81,3);
        WAIT(-1);
      END;

      IF mx≥106 AND mx≤157 THEN   // Button 3
        dp1:=0;dp2:=0;
        INPUT ({dp1,dp2},"Date+",{"date","xdays"},{"dd.mmyyyy =", "number"});
        TEXTOUT_P("New Date:",1,81,3);
        TEXTOUT_P(CALD((N→J(dp1)+dp2)),80,81,3);
        WAIT(-1);
      END;

      IF mx≥159 AND mx≤210 THEN   // Button 4
        doey:=0;
        INPUT (doey,"Year of Easter= ", "Enter year");
        TEXTOUT_P(DOE(doey),1,161,3);
         // WAIT(-1);
      END;

      IF mx≥212 AND mx≤263 THEN   // Button 5
        //
        // SUB-MENUE +++++++++++++++++++++++++++++++++++++++++++
        //
        // TS TimeSet - setting calculator's time
        // WMWK 2015-01-22   // wolfgang.kuehn@vodafone.de
        // special thanks to:
        //   Thomas Schirmer.  ( 'running time' routine)

        RECT();
        changed:=0; timstr2:=""; 
        TEXTOUT_P("Setting Calculator's Time V 0.99, special thanks to Thomas Schirmer",5,1,1);
        TEXTOUT_P("HH: ",7,200,2,#000000,24,#FFFFFF);
        TEXTOUT_P("MM: ",60,200,2,#000000,24,#FFFFFF);
        TEXTOUT_P("SS: ",120,200,2,#000000,24,#FFFFFF);
        DRAWMENU("- HRS +","- MIN+","- SEK +"," SET "," BYE "); 
        stime:=Time; stx:=STRING(stime);
        IF (IP(stime)<10) THEN stx:="0"+stx; END;
        xhh:=LEFT(stx,2); xmm:=MID(stx,4,2); xss:=MID(stx,7,2);
        // dhh:=0+IP(st1); dmm1:=60*(st1-dhh); dmm:=IP(dmm1); dss:=IP(60*(dmm1-dmm));
        dhh:=EXPR(xhh); dmm:=EXPR(xmm); dss:=EXPR(xss); 
        
        TEXTOUT_P(dhh+"    ",27,200,2,#000000,25,#FFFFFF);
        TEXTOUT_P(dmm+"    ",85,200,2,#000000,25,#FFFFFF);
        TEXTOUT_P(dss+"    ",135,200,2,#000000,25,#FFFFFF);
        
        While Z <= 9999 DO
           WHILE MOUSE(1)>=0 DO END;
           // inner loop
           REPEAT
              stime:=Time; stx:=STRING(stime);
              IF (IP(stime)<10) THEN stx:="0"+stx; END;
              xhh:= LEFT(stx,2); xmm:= MID(stx,4,2); xss:= MID(stx,7,2);
              //timstr:= xhh+ "ⓗ" +xmm + "ⓜ" +xss +"ⓢ"; 
              timstr:= " "+xhh+" ː "+xmm+" ː "+xss +" "; 
        
              IF (timstr <> timstr2) THEN 
                TEXTOUT_P("actual time: "+ timstr,10,100,7,#000000,300,#FFFFFF); 
                timstr2:=timstr; 
                IF (changed=0) THEN 
                    // dhh:=0+IP(st1); dmm1:=60*(st1-dhh); dmm:=IP(dmm1); dss:=IP(60*(dmm1-dmm));
                    dhh=EXPR(xhh); dmm:=EXPR(xmm); dss:=EXPR(xss); 
                    TEXTOUT_P(dhh+"    ",27,200,2,#000000,25,#FFFFFF);
                    TEXTOUT_P(dmm+"    ",85,200,2,#000000,25,#FFFFFF);
                    TEXTOUT_P(dss+"    ",135,200,2,#000000,25,#FFFFFF);
                END; 
              END;
              WAIT(0.05);

              m:=MOUSE;
              m1:=m(1);
           UNTIL SIZE(m1)>0;   // REPEAT
           mx:=m1(1);
           my:=m1(2);

           // query softbuttons  submenu
           IF my>=220 AND my<=239 THEN
             //
             // submenu button 1
             IF mx>=0 AND mx<=19 THEN
               dhh:=dhh-1; changed:=1;
               IF dhh<0 THEN dhh:=23; END;
               TEXTOUT_P(dhh+"    ",27,200,2,#000000,25,#FFFFFF);
             END;
             IF mx>=20 AND mx<=51 THEN
               dhh:=dhh+1; changed:=1;
               IF dhh>23 THEN dhh:=0; END;
               TEXTOUT_P(dhh+"     ",27,200,2,#000000,25,#FFFFFF);
             END;
           
             // submenu button 2
             IF mx>=53 AND mx<=72 THEN
             dmm:=dmm-1; changed:=1;
             IF dmm<0 THEN dmm:=59; END;
             TEXTOUT_P(dmm+"    ",85,200,2,#000000,25,#FFFFFF);
             END;
             IF mx>=72 AND mx<=104 THEN
             dmm:=dmm+1; changed:=1;
             IF dmm>59 THEN dmm:=0; END;
             TEXTOUT_P(dmm+"    ",85,200,2,#000000,25,#FFFFFF);
             END;
           
             // submenu button 3
             IF mx>=106 AND mx<=125 THEN
             dss:=dss-1; changed:=1;
             IF dss<0 THEN dss:=59; END;
             TEXTOUT_P(dss+"    ",135,200,2,#000000,25,#FFFFFF);
             END;
             IF mx>=126 AND mx<=157 THEN
             dss:=dss+1; changed:=1;
             IF dss>59 THEN dss:=0; END;
             TEXTOUT_P(dss+"    ",135,200,2,#000000,25,#FFFFFF);
             END;
           
             // submenu button 4
             IF mx>=159 AND mx<=210 THEN
                newtime:= dhh + (dmm/60) + (dss+0.1)/3600;
                Time:= newtime;
                TEXTOUT_P("set",175,200,2,#000000,25,#FFFFFF);
             END;
           
             // submenu button 5
             IF mx>=212 AND mx<=263 THEN
                DTM();
             END;   //   IF mx
           END;     //   IF my
        END;        //   WHILE Z    
        // END   SUBMENU timeset +++++++++++++++++++++++++++++++++++++++           
           
      END;     //    Button5  ( inner loop)
      //
      IF mx≥265 AND mx≤319 THEN   // Button 6
        KILL;
      END;  //   IF mx

    END;    //   IF my
  END;      //   WHILE Z

END;

Good regards for all.

Gérard.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
How Drawmenu work's? - fabio.hdl - 11-03-2016, 05:02 PM
RE: How Drawmenu work's? - Han - 11-03-2016, 06:41 PM
RE: How Drawmenu work's? - Tyann - 11-03-2016, 07:02 PM
RE: How Drawmenu work's? - StephenG1CMZ - 11-03-2016, 08:58 PM
RE: How Drawmenu work's? - toml_12953 - 11-04-2016, 02:28 PM
RE: How Drawmenu work's? - primer - 11-11-2016, 07:31 PM
RE: How Drawmenu work's? - fabio.hdl - 11-05-2016, 08:22 PM
RE: How Drawmenu work's? - compsystems - 11-12-2016, 01:36 AM
RE: How Drawmenu work's? - primer - 11-12-2016, 10:41 AM
RE: How Drawmenu work's? - compsystems - 11-12-2016, 02:53 PM
RE: How Drawmenu work's? - primer - 11-12-2016, 08:36 PM
RE: How Drawmenu work's? - StephenG1CMZ - 11-12-2016, 08:23 AM
RE: How Drawmenu work's? - compsystems - 11-12-2016, 09:05 PM
RE: How Drawmenu work's? - primer - 11-12-2016, 10:04 PM
RE: How Drawmenu work's? - compsystems - 11-14-2016, 04:03 AM
RE: How Drawmenu work's? - StephenG1CMZ - 11-14-2016, 09:03 AM
RE: How Drawmenu work's? - ggauny@live.fr - 01-25-2017, 12:11 PM
RE: How Drawmenu work's? - ggauny@live.fr - 01-25-2017 05:06 PM
RE: How Drawmenu work's? - primer - 01-25-2017, 11:18 PM



User(s) browsing this thread: 3 Guest(s)