Hi,
I am by trial and error, learning how to develop the HMI. I have an instance where I need a rectangle object to be filled a different colour when the value is 1. I have done this using one tag but ultimately 2 tags (either tag will have a value of 1 to fill the object a different colour) will be required to fill the object. A trawl through internet doesnt seem to give me any answers.
Thanks.
A rectangle object using multiple tags
Re: A rectangle object using multiple tags
I would add 1 more tag and set its value in scripting in the Tags page.
If you go to Tags -> Scripting -> select one of your tags to check its value and click the + next to its name in the list and double click the Value Change event to create a blank function.
Then in that function add an if statement to check if either Tag1 or Tag2 are 1, and set Tag3 to 1 if so. See below:
Then to get Tag2 to check on value change as well you can right click its Value change and "Hook up event" and select the same function as Tag1
Then set your Rectangle color to change based on Tag3's value
If you go to Tags -> Scripting -> select one of your tags to check its value and click the + next to its name in the list and double click the Value Change event to create a blank function.
Then in that function add an if statement to check if either Tag1 or Tag2 are 1, and set Tag3 to 1 if so. See below:
Code: Select all
void Tag1_ValueChange(System.Object sender, Core.Api.DataSource.ValueChangedEventArgs e)
{
if(Tag1.Value == 1 || Tag2.Value == 1)
{
Tag3.Value = 1;
}
}
Then to get Tag2 to check on value change as well you can right click its Value change and "Hook up event" and select the same function as Tag1
Then set your Rectangle color to change based on Tag3's value
Best regards,
Russ
(801) 708-6690
Technical Support
Contact Us
Beijer Electronics AB
http://www.beijerelectronics.us
Russ
(801) 708-6690
Technical Support
Contact Us
Beijer Electronics AB
http://www.beijerelectronics.us