• ×
    Information
    Windows update impacting certain printer icons and names. Microsoft is working on a solution.
    Click here to learn more
    Information
    Need Windows 11 help?
    Check documents on compatibility, FAQs, upgrade information and available fixes.
    Windows 11 Support Center.
  • post a message
  • ×
    Information
    Windows update impacting certain printer icons and names. Microsoft is working on a solution.
    Click here to learn more
    Information
    Need Windows 11 help?
    Check documents on compatibility, FAQs, upgrade information and available fixes.
    Windows 11 Support Center.
  • post a message
Guidelines
The HP Community is where owners of HP products, like you, volunteer to help each other find solutions.
Archived This topic has been archived. Information and links in this thread may no longer be available or relevant. If you have a question create a new topic by clicking here and select the appropriate board.
HP Recommended
HP Prime
Other

The Prime's manual (2nd ed., pages 571ff) teaches us that we can reassign keys in the user keyboard. The only example, however, is one where the corresponding "program" returns a string.

 

I, however, would like to execute my own program when a certain user key is pressed and I thought this will work:

 

EXPORT Next(N)
BEGIN
  IF odd(N) THEN
    RETURN 3*N+1;
  ELSE
    RETURN N/2;
  END;
END;

KEY K_Xttn(M)
BEGIN
  Next(M);
END;

However, back in the Home screen (I'm in UPN mode most of the time) when I put a number on the stack and then press Shift-Help (User) xttn-Key I just get an X in the input line. 😒 

 

So is there no way I can repeatedly execute my program by just pressing one key in the user keyboard (in persistent user mode)? This was something I very often did on my HP48 back then ... I, too, loved that I could press the top row keys for that and saw on the display what they did. Unfortunately, the Prime's menu keys on the display are just six all black rounded filled ractangles and totally useless. Or can I fill those with functionality?

4 REPLIES 4
HP Recommended

Hello,

 

if a user key returns a string, that string is handled as a text which is entered in the calculator.

if a user key returns a number, it is assume that this is a key code, which is executed instead of the original key.

all else is ignored and the original key is executed.

If you want no further actions taken than your program, return the number of a useless key (such as 41 for shift if I am not mistaken).

 

Cyrille

I am an HP Employee
HP Recommended

Thanks, Cyrille.

However, returning some integer that's not a keycode is not an option here because my program returns the result of a calculation and I want this to be on the stack – so that I can press the User-key again to take the result as input to my program.

So what was no problem on an HP48 is not possible on the Prime, right? 😒 

It would be SO cool if the useless, empty black key labels on the screen could be assigned to functions/programs like it was possible with the HP28/48/49/50 series ...

Best,

Stefan.

HP Recommended

It is not such a bad idea to let a user key return a string, because when the string is the name of a program, and we press Enter next, the program is executed!

 

So by pressing 1 key we will not get things done, but by pressing a key, and Enter next, we will.

 

Then our program is:

 

EXPORT Next(N)
BEGIN
  IF odd(N) THEN
    RETURN 3*N+1;
  ELSE
    RETURN N/2;
  END;
END;

KEY K_Xttn()
BEGIN
  RETURN "Next";
END;

 

 

HP Recommended

We can also write a program which allows us to tap an arbitrary key in order to achieve the same thing.

 

For this purpose we use the PRINT command and insert it into an endless loop.

 

To end the loop and the program press Shift – On.

 

Before starting the program assign a value to N.

 

 

NEXT();              //declaration of programs
MYPROG();

EXPORT NEXT()
BEGIN
  PRINT();             //clears the screen
  REPEAT               //start of loop
    PRINT(N);
    WAIT;           //waits for pressing key
    PRINT();        //clears the screen
    N:=MYPROG(N);    
  UNTIL 0;
END;

MYPROG(N)
BEGIN
 IF odd(N) THEN
   RETURN 3*N+1;
 ELSE
   RETURN N/2;
 END;
END;


 

Archived This topic has been archived. Information and links in this thread may no longer be available or relevant. If you have a question create a new topic by clicking here and select the appropriate board.
† The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the <a href="https://www8.hp.com/us/en/terms-of-use.html" class="udrlinesmall">Terms of Use</a> and <a href="/t5/custom/page/page-id/hp.rulespage" class="udrlinesmall"> Rules of Participation</a>.