HP Forums
Add button to program screen - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Add button to program screen (/thread-18268.html)



Add button to program screen - Grayhek - 04-16-2022 05:07 PM

I am trying to add a button to the screen of my program for the user to press if they want to go to the settings page. I have searched the threads here and online but not found anything that helps.

A simple explanation of what I am trying to do is create a program that calculates a paycheck given the hours worked including overtime. I want to add a button to a corner of the screen for the user to press that will navigate them to the page where they can input their hourly pay, tax % and a few more options.

Help figuring out how to add this navigation button is appreciated. (I know there is a simpler way of making this program, but I am using this as a way to teach myself the different features and ways to use the HP Prime)


RE: Add button to program screen - Dougggg - 04-17-2022 01:28 AM

This code may give you an idea

Code:

EXPORT TESTMENU()
BEGIN

 LOCAL mSEL,my,mx,m,m1;
  REPEAT
    WHILE MOUSE(1)≥0 DO END;
    DRAWMENU("1CONT","","","","","6ABORT");
    REPEAT
      m := MOUSE;
      m1 := m(1);
    UNTIL SIZE(m1)>0;
    mx := B→R(m1(1)); 
    my := B→R(m1(2));
    mSEL := 0;
    IF my≥220 AND my≤239 THEN
      IF mx≥0 AND mx≤51 THEN
        mSEL := 1;
      END;
      IF mx≥265 AND mx≤319 THEN
        mSEL := 6;
      END;
    END;
    IF mSEL == 1 THEN
       PRINT();
       PRINT("1");
    END;
    IF mSEL == 6 THEN
       PRINT();
       PRINT("6");
    END;
    
  UNTIL mSEL==6  OR mSEL==1;
END;



RE: Add button to program screen - tgallo - 04-20-2022 10:34 PM

I've done this exact thing in my Slider game. I added a "Scramble" button. I just drew a rectangle and added text on top. Then I just check to see if the the user presses in that area. That code is pretty much the same as what Dougggg posted above.

If you want to see my code go here:
http://my.tbaytel.net/tgallo/hp%20prime/

Download and look at the Slider code.


RE: Add button to program screen - Thomas_Sch - 04-21-2022 05:10 AM

Another one, same principle,
buttons and also slider (also with source code)
https://www.hpmuseum.org/forum/thread-2815.html?highlight=slider