HP Forums
Program template - scroller example - 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: Program template - scroller example (/thread-7006.html)



Program template - scroller example - primer - 10-09-2016 02:30 PM

Hello,
I'm sharing here a small template I made to help building programs that need to displays graphics with scrolling.

Of course, this template have to be customized to build your own program, but it works out of the box with an example (it displays a graphic, and interact with mouse and key)

Features list :
- touchscreen horizontal and vertical scroll
- mouse click, it triggers function click(x,y) : draw a blue box in this example
- mouse double-click, it triggers function doubleclick(x,y) : draw a pink box in this example
- scroll with arrow keys (contiunous scrolling)
- enter key triggers function action() : invert screen in this example
- ESC key, to leave the program.

Important : This template use libList, download it here, you need to install it to make it work.
[attachment=4032]

For example,
To build a picture viewer program, all you have to do is to modify functions to have :
Code:

init()
BEGIN
G1:=AFiles("image.png");
END;

click(x,y) // do nothing
BEGIN
END;

doubleclick(x,y) // do nothing
BEGIN
END;

action() // do nothing
BEGIN
END;
it have never been so easier Wink


RE: Program template - scroller example - compsystems - 10-09-2016 04:23 PM

Hi, I want to show an algebraic expression when given a click for exmaple

Hi, I want to show an linear algebraic expression when given a click

as I can do this?

click(x,y)
BEGIN
print(-(x+y)*5!+abs(-4)+cos(45)+ sin(π/3+π)+Σ(j,j,1,3)+√(−2)+4/3-logb(1,10);
END;


RE: Program template - scroller example - primer - 10-09-2016 07:18 PM

Hi,
if you use PRINT(), it will print on terminal, which is maybe not what you want.
if you want to print on the screen, you had to use TEXTOUT_P on G1.
But I don't know if it's possible to pretty print algebraic expression...