I believe I tried that, but the variables are setup within a function, is that limiting me in scope? The button press calls the function located in <API> which does call the function and the function runs but those values don't seem to be 'gettable' anywhere else.
Also, am I correct that I cannot script JavaScript like a class constructor to build an array of objects? I will have to use the XML object and/or setup every variable in <API>?
Thanks James!
------------------------------
Matt Rasmussen
FinePoint Technology
------------------------------
Original Message:
Sent: 05-25-2022 13:32
From: James Peltzer
Subject: Object creation
If you define variables in an <api/> block at the top-level scope of your panel, you can get or set them in other scripts in your panel if you don't wish to use ogscript.putObject/getObject.
<abs contexttype="opengear" gridsize="20" id="_top" keepalive="false"> <meta> <api>var name = "James";</api> </meta> <button buttontype="push" height="100" left="40" name="Set Name" top="60" width="220"> <task tasktype="ogscript">name = "Jack";</task> </button> <button buttontype="push" height="100" left="40" name="Debug Name" top="180" width="220"> <task tasktype="ogscript">ogscript.debug(name);</task> </button></abs>
------------------------------
James Peltzer
Ross Video
Original Message:
Sent: 05-25-2022 09:39
From: Matt Rasmussen
Subject: Object creation
Is the only way to create a global object by using the ogscript put/get object method? We cannot use a standard JavaScript object, ie create an array of JavaScript objects?
------------------------------
Matt Rasmussen
FinePoint Technology
------------------------------