Support Forums
Iterative drawing of widget

Hi,
I am new to VTScada and I am testing out the scripting potential of the platform.
I started out by creating a widget that display my typical dataset linked to tags. To display that widget I used the GUITransform function.
Now I obviously don't only have one but many of those that I want to display on the same screen. Also the number will change dynamically so they will have to be in a list.
Here come the problem. How can I display an arbitrary amount of widget? The thing is, since GUITransform is only usable in steady-state, I cannot just use a loop to iterate through the list and display each one because loops are script only.
There most be an easy way to do that but I can't figure it out. Either there is a way to display a widget other then GUITransform that is usable in script or there is a way to iterate in stady-state that I haven't found.

Hi, I am new to VTScada and I am testing out the scripting potential of the platform. I started out by creating a widget that display my typical dataset linked to tags. To display that widget I used the GUITransform function. Now I obviously don't only have one but many of those that I want to display on the same screen. Also the number will change dynamically so they will have to be in a list. Here come the problem. How can I display an arbitrary amount of widget? The thing is, since GUITransform is only usable in steady-state, I cannot just use a loop to iterate through the list and display each one because loops are script only. There most be an easy way to do that but I can't figure it out. Either there is a way to display a widget other then GUITransform that is usable in script or there is a way to iterate in stady-state that I haven't found.

I understand you are looking to work with the scripting but, in this case, I think you can use the included tag Tag List Widget.

I'd suggest you ease into the scripting and take a look at our Programmers Guide to help get started.

The approach to scripting your widget would be to create a sub-module that contains the GUITransform for each item you want to display. A script block in a state can then be triggered to launch these submodules. You could keep track of the object values of these launched sub-modules in an array. The same script can be retriggered by some condition when modules need to be added or deleted by iterating through the array. And yes, this getting into advanced scripting.

I understand you are looking to work with the scripting but, in this case, I think you can use the included tag [Tag List Widget](https://www.trihedral.com/help/Content/D_Widgets/Dev_TagListWidget.htm). I'd suggest you ease into the scripting and take a look at our [Programmers Guide](https://www.trihedral.com/wp-content/uploads/2016/09/VTScada11-2-ProgrammersGuide.pdf) to help get started. The approach to scripting your widget would be to create a sub-module that contains the GUITransform for each item you want to display. A script block in a state can then be triggered to launch these submodules. You could keep track of the object values of these launched sub-modules in an array. The same script can be retriggered by some condition when modules need to be added or deleted by iterating through the array. And yes, this getting into advanced scripting.

Trihedral Engineering Ltd.

edited Feb 1 '18 at 5:36 pm

Hi Dave,

Thx for the quick reply. If I understand correctly, if I put the GUITransform of the widget into a submodule with parameters I should then be able to launch multiple instance of it in a script. If soo, that is exactly what I wanted. I will try that.
Hi Dave, Thx for the quick reply. If I understand correctly, if I put the GUITransform of the widget into a submodule with parameters I should then be able to launch multiple instance of it in a script. If soo, that is exactly what I wanted. I will try that.

I think the first point that Dave made is the most important. Before attempting to write script code, try the built-in features. As a VTScada instructor, I often see a similar situation where someone with a background in programming turns first to the scripting language rather than the existing features. Kind of like, if you have a hammer, everything looks like a nail.
Couple of points:

1) For your situation, it sounds like the best solution will involve:
a) tags to read the data, not script code.
b) a widget or custom widget created using the Idea Studio, not script code.
c) a tag list widget, maybe with a bit of expression coding, to display an array of b).

2) GUITransforms are not, never were, and never will be, meant for humans to type. Yes, they're documented, but leave them for the Idea Studio to generate. You can tweak parameters if needed.

3) The beauty of steady state is never needing to write a loop to refresh data. That's a big part of why VTScada is so efficient! Don't ruin that by trying to work around it.

I think the first point that Dave made is the most important. Before attempting to write script code, try the built-in features. As a VTScada instructor, I often see a similar situation where someone with a background in programming turns first to the scripting language rather than the existing features. Kind of like, if you have a hammer, everything looks like a nail. Couple of points: 1) For your situation, it sounds like the best solution will involve: a) tags to read the data, not script code. b) a widget or custom widget created using the Idea Studio, not script code. c) a tag list widget, maybe with a bit of expression coding, to display an array of b). 2) GUITransforms are not, never were, and never will be, meant for humans to type. Yes, they're documented, but leave them for the Idea Studio to generate. You can tweak parameters if needed. 3) The beauty of steady state is never needing to write a loop to refresh data. That's a big part of why VTScada is so efficient! Don't ruin that by trying to work around it.
213
3
3
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft