Page 1 of 1

_InputValueChanged AnalogNumeric - incremental numeric field

Posted: Thu Dec 03, 2015 3:15 am
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

Re: _InputValueChanged AnalogNumeric - incremental numeric f

Posted: Wed Jan 29, 2020 3:06 pm
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;
		}