HP Forums
cant save grob - 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: cant save grob (/thread-5604.html)



cant save grob - ji3m - 01-28-2016 09:06 PM

AFiles ("pic"):= G0 seems to work

but

G0 := AFiles ("pic"); returns error, bad object type.

so how to save a grob?


RE: cant save grob - Tyann - 01-28-2016 09:55 PM

Bonjour
Essayez
Code:
AFiles("pic.png"):=G0;
puis
Code:
 G0:=AFiles("pic.png";)
.


RE: cant save grob - ji3m - 01-28-2016 10:31 PM

addig .png or .PNG improves nothing. It doesnt work.
Try it.


RE: cant save grob - DrD - 01-28-2016 10:46 PM

From the user guide (around page 412):

:=
Stores the evaluated expression in the variable. Note that:= cannot be used with the graphics variables G0–G9. See the command BLIT.


RE: cant save grob - Tyann - 01-29-2016 06:08 AM

Bonjour
J'ai utilisé cette possibilité dans un de mes programmes
et cela fonctionne !

Hello
I used this opportunity in one of my programs
and it works !

Cet exemple simple fonctionne sur ma Prime :
This simple example works on my Prime:
Code:

EXPORT ESSAIG()
BEGIN
RECT_P();
TRIANGLE_P(10,10,280,80,20,160);
AFiles("V1"):=G0;
WAIT(2);
RECT_P();
WAIT(2);
G0:=AFiles("V1");
WAIT(-1);
END;



RE: cant save grob - Didier Lachieze - 01-29-2016 07:16 AM

This works for me (tested on the real Prime, the Windows emulator and the Android app):

Code:
EXPORT test1()
BEGIN
AFiles("pic.png"):=G0;
END;

EXPORT test2()
BEGIN
G0:=AFiles("pic.png");
FREEZE;
END;

Enter some data on your Home screen, run test1 then clear the Home screen and run test2. Press Home to return to the active screen.

However one thing to keep in mind is that AFiles and AVars scope is limited to the current active Application (as implied by their name).
If now you go to Apps, change the current application and go back to Home, test2 will return "Error: invalid input" as pic.png doesn’t exist for the new active application.


RE: cant save grob - StephenG1CMZ - 05-10-2016 10:26 PM

(01-29-2016 07:16 AM)Didier Lachieze Wrote:  This works for me (tested on the real Prime, the Windows emulator and the Android app):

Code:
EXPORT test1()
BEGIN
AFiles("pic.png"):=G0;
END;

EXPORT test2()
BEGIN
G0:=AFiles("pic.png");
FREEZE;
END;

Enter some data on your Home screen, run test1 then clear the Home screen and run test2. Press Home to return to the active screen.

However one thing to keep in mind is that AFiles and AVars scope is limited to the current active Application (as implied by their name).
If now you go to Apps, change the current application and go back to Home, test2 will return "Error: invalid input" as pic.png doesn’t exist for the new active application.

I had read that AFiles were limited to an Application - and presumed that that meant that I couldn't use them in my program, which so far have been simple programs not requiring inclusion within an App.

But I just gave it a try, and was pleasantly surprised to discover that AFiles seem to work in ordinary programs. It might be worthwhile making that clearer in the documentation: you don't have to be using an App and a STARTVIEW to use AFiles. Or is it just me that misunderstood that?
(No sign of the .PNG in the Android gallery though Sad - only within the HP Prime emulator ).


RE: cant save grob - cyrille de brébisson - 05-11-2016 05:50 AM

Hello,

You can use the AFiles command anywhere...
BUT the file is 'linked' with the current application (hence the A for Application, in AFiles).

This means that if you switch app, the file will 'disapear' (well, it will not, of course, if you switch back to the original app, it will re-apear), but I hope that you understand the concept.

This is because application are directories, which means that they can host a collection of things (such as programs, notes and files), while programs are single files. so they can not have sub-files.

Cyrille