Ahhh, thank you again @James Peltzer for another quick and great sollution.
This solves it triggering one of the choice constraints I have. As the one in your example has an OID of "choice".
How would I best access that part of the Rosstalk message in the function?
event.getState() gives access to the number I add to the message, but how do I access the name of what parameter I am trying to trigger?
I can of course just use "event" string and get the source=choice (from your example), but I figured since you can access the State as well, I assume we can also access the first part in an elegant way. The help documentation about how to trigger things externally only covers the getState() function.
EDIT - After some more testing and trial...
Well, ask a question, and you often find the answer to your question right after it. In this case it was as simple as accessing the event object and using the source name. Meaning event.source gives access to what I was looking for.
However, looking over your examples yet again, It becomes clear after some trial and error that the trigger here is actually defined in the ogscript.addRemoteTrigger, meaning if you want to trigger two different panels, you can just copy/paste the first addRemoteTrigger, add a new one, with a new trigger that targets the second parameter.
Soooo that works even better. Thanks again!
------------------------------
Aleksander Stalsberg
Inland Norway University of Applied Sciences/Lillehammer Icehockey Club
Norway
------------------------------
Original Message:
Sent: 03-01-2024 10:44
From: James Peltzer
Subject: Companion - RossTalk GPI by Name to trigger Choice Constraint Int Array
Hi Aleksander
Your fastest path here would be to use a small piece of script registered against the trigger ID instead of using the toggle buttons directly:
<abs contexttype="opengear" id="_top" keepalive="false" style=""> <meta> <params> <param access="1" constrainttype="INT_CHOICE" name="My Choices" oid="My_Choices" precision="0" type="INT32" value="1" widget="radio-toggle"> <constraint key="1">One</constraint> <constraint key="2">Two</constraint> <constraint key="3">Three</constraint> </param> </params> <ogscript handles="onload">ogscript.addRemoteTrigger('choice', function(event){ if (event.getState() == null) { return; } var state = parseInt(event.getState()); params.setValue('My_Choices', 0, state);});</ogscript> </meta> <param expand="true" height="104" left="58" oid="My_Choices" style="style:toggleButton;" top="64" width="520"> <task tasktype="ogscript">ogscript.debug('Choice Changed: ' + this.getValue());</task> </param> <button buttontype="push" height="122" left="126" name="Fire GPI choices:1" top="384" width="285"> <task tasktype="ogscript">ogscript.fireGPI("choice", 1, true);</task> </button> <button buttontype="push" height="122" left="433" name="Fire GPI choices:2" top="385" width="285"> <task tasktype="ogscript">ogscript.fireGPI("choice", 2, true);</task> </button></abs>
The relevant part here is the ogscript running onload to add the remote trigger registered against the trigger ID of "choices":
ogscript.addRemoteTrigger('choice', function(event){ if (event.getState() == null) { return; } var state = parseInt(event.getState()); params.setValue('My_Choices', 0, state);});
------------------------------
James Peltzer
Ross Video
------------------------------