The Museum of HP Calculators

HP Forum Archive 21

[ Return to Index | Top of Index ]

HP Prime touch button
Message #1 Posted by SanS on 10 Oct 2013, 6:34 a.m.

I'm trying to learn some programming concepts for the HP Prime and I wonder how you can create touch buttons within a program to perform a specific action. On the other hand, I also wonder if there is any alternative to the command CHOOSE to create a menu on the screen. With my limited knowledge I suspect that with the command GETPIX I can get the information of a pixel region but which is the command to get the touch on the screen?

      
Re: HP Prime touch button
Message #2 Posted by Han on 10 Oct 2013, 9:02 a.m.,
in response to message #1 by SanS

The command you're looking for is called MOUSE

            
Re: HP Prime touch button
Message #3 Posted by Sans on 10 Oct 2013, 12:16 p.m.,
in response to message #2 by Han

Thank you Han, but how to use this command? I don't see in the user guide enough information about this topic.

                  
Re: HP Prime touch button
Message #4 Posted by Han on 10 Oct 2013, 12:24 p.m.,
in response to message #3 by Sans

Quote:
Thank you Han, but how to use this command? I don't see in the user guide enough information about this topic.

Page 549-553 gives you a list of other I/O commands including mouse.

Syntax: MOUSE[(index)]

Returns two lists describing the current location of each potential pointer (or empty lists if the pointers are not used). The output is {x , y, original z, original y, type} where type is 0 (for new), 1 (for completed), 2 (for drag), 3 (for stretch), 4 (for rotate), and 5 (for long click). The optional parameter index is the nth element that would have been returned—x, y, original x, etc.—had the parameter been omitted (or –1 if no pointer activity had occurred).

For touch/taps, the second of the two lists is empty. For pinch-like motions, both lists are non-empty (each list corresponding to a touchpoint on the screen).

Try the following program snippet:

EXPORT EGMOUSE()
BEGIN
  WHILE 1 DO
    PRINT(MOUSE());
  END;
END;

Press [On] to abort; otherwise touch/drag the screen.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall