Using complex code in a widget

JBooth

Member
Join Date
Oct 2013
Location
Palmetto, Ga
Posts
70
Ok, so i mostly have this widget thing figured out, but i am having some trouble getting my complex code to work properly with the folder binding. Here is what i have:
A multi-layered set of groups where each groups visible state is tied to a multi-state tag that is incremented and decremented by a next and previous push-button respectively. I named the multi-state tag Display and have code in place for the on-select field of the page to set Display = 1;, the next button has an action set as user-defined, with a code of
if (Display <= 5)
{
Display ++;
}
if (Display == 6)
{
Display = 1;
}

so that the display count goes up until it reaches the limit and then goes back to the first page. Previous button does the same thing in reverse. When i put the Display tag in the data definition of the widget and bind a folder to it, the complex code does not update with the folder path. I am temporarily working around this by making the Display tag outside of the folder, not putting that tag in the data definition of the widget, and after creating and binding the widget, dragging the tag into the folder, so all instances are updated with the correct path. But I am trying to set this up so the guys who will be inserting this widget dont have to do that, they can just bind a folder and be done. Is there any way to get tag names in complex code to work with binding?
Sorry for the length here.
 
I'm not sure if I can help or not, but it would probably help others answer your question if you include what platform (and version) you're programming on. Is this a SCADA system?
 
How many pages do you have, assuming 6, judging by your count? Why not just use (6) soft keys to trigger the goto page in the global setting. This will also free up some real estate on the HMI.
 
There are three pages, but this widget is only on one of them, the other two are for data trending. There are 5 different groups of objects stacked on top of each other in the widget, but only one is visible at a time. Allows me to use one page and one widget instead of 5. This way I only have to bind once, not multiple times. Tried doing it on 5 seperate pages, and it didnt work as well as what i have now.
 
JBooth,

See if the edit is what your looking for. When adding the "Display" tag, choose to only display the value otherwise the label will overlay the value. Another thing is that you created the widget, set the count to 3, try changing the data type to integer, and flags to tag.

Then on the next screen, widget property, your data 1, will be the incremental up complex code, data 2 will be your "display" tag, and data 3 will be your decrements complex code.

Hope this helps

K
 
I don't need to put that tag onto the page. It is used in the complex code of the action for the next and previous buttons(the red and blue buttons shown on the page), and in the visible fields for my data groups. The problem is, when i add Display tag to the widget definition, then bind a folder, the complex code is not updated to include the full path folder.display, it stays as display. So when i press previous or next, the displayed data group does not change like i want it to. I am not changing pages with this tag, or showing the tag, just using it to change from power factor group to volts line-line group to volts line-neutral group and so on.
May be able to add a couple of tags to replace the complex code though, will play with it and see.
 
ok, so taking what kay_gsr13 said, i was able to get the buttons working properly within the widget. Unfortunately, the leds beside power factor, volts l-l, volts l-n, amps, and kW still wont work that way. Going to get rid of the animated images and just tie some simple images to my current groups and see if that will take care of it.
 

Similar Topics

I have a project to automate four generator sets. The system will monitor and store the load demand of the factory. Once there's Power outage, the...
Replies
0
Views
13
Adding ethernet equipment to an existing panel that has none. We have some solid ethernet cables coming from other remote cabinets that I plan to...
Replies
3
Views
92
I'm trying to control a device via MODBUS RTU and the ModbusRtuMasterV2_PcCOM in Twincat 3. I've configured a device with the right com port and...
Replies
7
Views
188
Hi, I'm trying to use the IO Device Library (Product Versions) which is configured to work with the 1756-EN4TR & 1756-EN2TR but my system uses...
Replies
0
Views
50
Hello, As part of our project, we are using an M241 controller. This controller interfaces with an industrial computer and a router via a switch...
Replies
2
Views
95
Back
Top Bottom