HP Forums
String Variable - 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: String Variable (/thread-8427.html)



String Variable - KeithB - 05-30-2017 05:08 PM

What should I use for a string variable?

Let me ask my real question: I am putting some text on the screen using TEXTOUT() and since the string might be variable length it sometimes leaves junk even if I write the background color. What is the accepted way to fix this? re-write the original screen with the bg color? send a bunch of spaces?

Also, is there any clever way to get the screen back if I call INPUT()?


RE: String Variable - Tyann - 05-31-2017 03:49 AM

(05-30-2017 05:08 PM)KeithB Wrote:  What should I use for a string variable?

Let me ask my real question: I am putting some text on the screen using TEXTOUT() and since the string might be variable length it sometimes leaves junk even if I write the background color. What is the accepted way to fix this? re-write the original screen with the bg color? send a bunch of spaces?

Also, is there any clever way to get the screen back if I call INPUT()?

Bonjour

Vous pouvez utiliser var:=TEXTOUT_P("message",x,y...) pour connaître la coordonnée x de fin d'affichage, ensuite moi
je ferai un RECT_P(x,y1,var,y2....)

Pour INPUT vous pouvez utiliser BLIT_P(Gx,G0) puis BLIT_P(G0,Gx) ou
Afiles("nom"):=G0 puis G0:=Afiles("nom").

Espérant vous être utile.

Hello

You can use :
var: = TEXTOUT_P ("message", x, y ...) to know the end x display x coordinate, then me
I will do a RECT_P (x, y1, var, y2 ....)

For INPUT you can use BLIT_P (Gx, G0) then BLIT_P (G0, Gx) or
Afiles ("name"): = G0 then G0: = Afiles ("name").

Hoping to be useful.


RE: String Variable - KeithB - 05-31-2017 02:43 PM

Thanks - I got the gist, good idea!


RE: String Variable - Han - 06-01-2017 03:57 AM

Use RECT or RECT_P to erase the block you wish to "write" and then "write" using TEXTOUT (or TEXTOUT_P). As Tyann suggested, you can also use the output of the TEXTOUT command (which returns the x-coordinate of the "end" of the message string that got printed) to erase, via RECT, to the end of the screen.

I think the best way is to draw in a separate buffer (say G1) by first erasing the row with RECT_P(G1,x1,y1,x2,y2) and then using BLIT_P(G1).