How can I declare my function like the one (“setValueBool”) from B&R-Widget to be typesafe?
Hi @Pad_Dern
I’m not a user of EventScripts but I’m a user of the WDTC and from what I know methods of B&R Widget (or custom from WDTC) are types using WDTC. As Javascript is a non-typed language, I would say that you cannot type your function.
Maybe there is a special comment to using like in WDTC but I’m not sure (there is no info about this in help), for example in WDTC when you declare a method of a widget you can have this type of comment:
/**
* @method setBackColorExt
* @iatStudioExposed
* Sets the back color of the widget.
* @param {String} value The back color to be set
*/
p.setBackColorExt = function (value) {
I think AS use description files from widgets to show you the function signature but in eventscript itself, I’m not sure you can do it ![]()
Hope this help!
Regards,
Florent
Thank you. I saw this already but I would prefer to have an compiler fault ![]()
Maybe you know what is wrong here?
opcua(‘::LineCtrl:stGui.BirdViewTransfStr’).valueChanged(function(e) {
const result = e.detail.newValue;
variables.OpcChanged_BirdViewTransfStr.setValueString(result);
}
→ is it possible that the string can be too long? (is not → tested with “test”)
It is the transfer string for a paper widget. OPC path is correct (I connected the OPC string directly to the paper widget to see the path in the diagnostic page).
When this string is not connected to the paper widget it is not visible in diagnostic page (http://127.0.0.1:81/server/info)
→ looks like the subscription is not created ![]()
If I get it right, you subscribe to a opcua string variable (value changed event), grab the new value then set it to a session variable “OpcChanged_BirdViewTransfStr”?
And this opcua string variable is the “Transform” property of a Paper widget?
I’m right?
I’m gonna check tonight making a test project about it, I’m not sure it’s a length problem at least I shouldn’t be ^^’
Function is working now.
I don’t really know what happend or is different now
OPC event wasn’t fired but after several recompiles it worked… maybe a syntax problem
