Post Reply 
Add button to program screen
04-16-2022, 05:07 PM
Post: #1
Add button to program screen
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)
Find all posts by this user
Quote this message in a reply
04-17-2022, 01:28 AM
Post: #2
RE: Add button to program screen
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;
Find all posts by this user
Quote this message in a reply
04-20-2022, 10:34 PM
Post: #3
RE: Add button to program screen
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.
Find all posts by this user
Quote this message in a reply
04-21-2022, 05:10 AM
Post: #4
RE: Add button to program screen
Another one, same principle,
buttons and also slider (also with source code)
https://www.hpmuseum.org/forum/thread-28...ght=slider
Find all posts by this user
Quote this message in a reply
Post Reply 




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