A rectangle object using multiple tags

Discussion of application development using iX Developer, including but not limited to getting started, using the functions tab, properties, objects and installation.
Post Reply
markpb
Posts: 1
Joined: Fri May 26, 2017 5:20 am

A rectangle object using multiple tags

Post by markpb »

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.

User avatar
Russ C.
Posts: 213
Joined: Thu Nov 16, 2017 3:32 pm
Contact:

Re: A rectangle object using multiple tags

Post by Russ C. »

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:

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
Tags_Events.png
Tags_Events.png (38.6 KiB) Viewed 3265 times

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

Post Reply