_InputValueChanged AnalogNumeric - incremental numeric field

A forum devoted to the discussion of all topics having to do with scripting and other advanced programming using iX Developer.
Post Reply
andrea
Posts: 72
Joined: Tue Dec 11, 2012 5:44 am

_InputValueChanged AnalogNumeric - incremental numeric field

Post by andrea »

Hello,

I ask you if and how it is possible to fire the event "InputValueChanged" also if I insert the same value already present.

For example the tag has value 50 and I insert again 50 -> the event does not happen.

We are trying to make AnalogNumeric field incremental in some circustances and need to add the new value inserted in keypad calculator to the one already inserted in that field.

In this case 50 + 50, new value 100.

It already works if we insert any whatever value different from the one already inserted before (50 in the example)

Do you have suggestions?

Thank you

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

Re: _InputValueChanged AnalogNumeric - incremental numeric f

Post by Russ C. »

Here is a snippet of code, that could accomplish what you're asking

Code: Select all

      int prevValue = 0;
		int totalValue = 0;
		void AnalogNumeric_InputValueChanged(System.Object sender, Core.Api.DataSource.ValueChangedEventArgs e)
		{
			
			totalValue += prevValue = Int16.Parse(AnalogNumeric.Value.ToString());			
			MessageBox.Show(totalValue.ToString());

		}
		
		void AnalogNumeric_GotFocus(System.Object sender, System.EventArgs e)
		{
			AnalogNumeric.Value = 0;
		}
		
		void AnalogNumeric_LostFocus(System.Object sender, System.EventArgs e)
		{
			AnalogNumeric.Value = prevValue;
		}

Best regards,

Russ
(801) 708-6690
Technical Support
Contact Us

Beijer Electronics AB
http://www.beijerelectronics.us

Post Reply