Post Reply 
Why Error?
05-19-2021, 12:23 PM (This post was last modified: 05-19-2021 12:33 PM by C.Ret.)
Post: #5
RE: Why Error?
(05-19-2021 02:38 AM)toml_12953 Wrote:  
Code:
EXPORT ErrPgm()
BEGIN
Xmin:=-15;Xmax:=370;
END;

Since in this code Xmin and Xmax are not define as local variables, this code assume they exist in the global environment.

If the currently selected application have these Application Variables; no problem, your code will modify their value.

Please check if the emulator and the physical HP prime have the same application selected. this may explain the different behaviour.

Quote:
Code:
EXPORT ErrPgm()
BEGIN
LOCAL Xmin, Xmax;
Xmin:=-15;Xmax:=370;
END;

Here the two variables are local and the code runs without issue whenever the selected application have Xmin and Ymax global variables or not .
But, if your goal was to set any graphical coordinate for a future plot view, you fall ! Local variable have nothing to do with Graphic Plots ! So, you have to be sure a graphical application is selected before using Xmin Xmax Ymin Ymax etc plot window's varaibles.

To select an application in a program use the STARTAPP command:
Code:
EXPORT ErrPgm()
BEGIN
STARTAPP("Function");
Xmin:=-15;Xmax:=370;
END;
This will start the Function application which use Xmin ... Ymax Application Variables .

Alternatively, you can qualify you global variable, just add the name of the Application in reference. This is the way to design an Application Variable independently of the current Application being selected:
Code:
EXPORT ErrPgm()
BEGIN
Function.Xmin:=-15;
Function.Xmax:=370;
END;
So you can qualify varaible of the Function Application when using another Application environnement.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Why Error? - toml_12953 - 05-19-2021, 02:38 AM
RE: Why Error? - Dougggg - 05-19-2021, 03:24 AM
RE: Why Error? - Tim Wessman - 05-19-2021, 03:29 AM
RE: Why Error? - toml_12953 - 05-19-2021, 08:12 AM
RE: Why Error? - Bram - 05-19-2021, 06:55 PM
RE: Why Error? - C.Ret - 05-19-2021 12:23 PM



User(s) browsing this thread: 1 Guest(s)