Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

NumericEdit control fast user change?

Hello. I noticed this problem in the context of a bigger application,  so I created a simple form application in C# with a single NumericEdit control.

I subscribe to the AfterChangeValue event. If I enter in a different number and hit enter very quickly after, the AfterChangeValue event does not fire. The value in the control reverts back to its previous value. If I enter a different number, wait a bit, and then hit enter, the event fires and everything works well.

Am I missing something? I also tried the BeforeChangeValue and ValueChanged events. I tried this on multiple PCs. Same result. Why do these events not fire under these circumstances?

Thanks,
Chris Pendleton
0 Kudos
Message 1 of 10
(4,285 Views)
Hi Pyramid,

I have been attempting to re-create this issue but have been unable to do so thus far.  What specifically are you doing in the AfterChangeValue / BeforeChangeValue / ValueChanged event callbacks?  If possible, can you include the simple application that you created to test this problem?
0 Kudos
Message 2 of 10
(4,266 Views)
I attached the project. I am doing nothing in the event handlers. I put some dummy variable declaration in there to break on.

I have 2 controls on the screen - an NI NumericEdit and a native .NET NumericUpDown. The procedure I followed was 1) highlight the text in the control then 2) hit a number (different than the current value) and then enter very quickly (1/3 of a second later?). You can see the new number appear for a short moment, and then it reverts to the old value. The events do not fire on the NI NumericEdit. This happens reliably on multiple PCs. I am running Measurement Studio 8.1.1, VS 2005, .NET framework v2.0, and Windows XP Pro SP2.

The native .NET NumericUpDown functions as expected, with events always firing.

If you still cannot reproduce this, I will try to send you a video of the screen or something.

Thanks,
Chris Pendleton


0 Kudos
Message 3 of 10
(4,263 Views)
I attached an AVI video of my screen showing the problem. This is using the C# project that I sent you.

The initial value is 5. I try to change it to 4. You can see 4 appear for a brief moment, and then it is replaced by the initial value 5. No ChangeValue events fire.

Thanks,
Chris Pendleton

0 Kudos
Message 4 of 10
(4,260 Views)
Hi Chris,

I was successfully able to reproduce the issue on my machine as well.  It only occurs when you hit enter very rapidly after changing the value as you stated. This was reported to R&D (#4EMG934B) for further investigation. If you ever have any questions regarding the status of this issue, you can call in and use this number (#4EMG934B) as a reference.
0 Kudos
Message 5 of 10
(4,242 Views)
We would like to use the NI Measurement Studio NumericEdit control in our applications, but this bug might not allow us to do that. Many people are fast with the keyboard and will tend to use the control just like that.

Thanks for your time.
Regards,
Chris Pendleton
0 Kudos
Message 6 of 10
(4,233 Views)
What exactly is the process here? Will you offer a hotfix for this problem? Will you wait until the next release?

I just want to know if we can rely on this bug getting fixed, and an estimated time frame for that fix.

Thanks,
Chris Pendleton
0 Kudos
Message 7 of 10
(4,231 Views)
Have you tried to set the flag ImmediateUpdate to true?
 
It is not recommended in genaral case, but may be in your case this might be a workaround.
 
Hope this helps,
 
Jean
 
 
0 Kudos
Message 8 of 10
(4,210 Views)
Hello,

I have cheked and this behavior still occurs even with the ImmediateUpdate set to true.

Engineering is aware of this issue and it is currently under investigation. We currently do not have a timeline on when future status updates will be made for this issue.  As soon as I have any additional information, I will post it to this thread.

0 Kudos
Message 9 of 10
(4,184 Views)
Pyramid,
I have created a work around for this issue that requires you to derive from the NumericEdit control and use an instance of this derived control in your application. The dervied class is outlined below.
A couple of things to note:
  • The MyNumericEdit class below has not been thoroughly tested but it does change the value (and raise the corresponding events) when you hit the Enter key really quickly after typing into the control.
  • The event arguments that you will receive in the BeforeChangeValue and AfterChangeValue will have the Action property set to Programmatic rather than ByKeyboard. In some cases, the event arguments may include other values that are unexpected too. So, if your code relies on the event arguments for these events to be absolutely accurate, then the implementation below will not work for you.
        public class MyNumericEdit : NationalInstruments.UI.WindowsForms.NumericEdit
        {
            protected override void OnKeyDown(KeyEventArgs e)
            {
                if (e.KeyCode == Keys.Enter)
                {
                    double newValue;
                    bool success = Double.TryParse(this.Text, out newValue);

                    if (success)
                    {
                        Value = newValue;
                    }
                }

                base.OnKeyDown(e);
            }
        }

Please let me know how this works out for you. If there is anything else regarding this issue that our support team can help you with, please let us know.

Abhishek Ghuwalewala | Measurement Studio | National Instruments
0 Kudos
Message 10 of 10
(4,176 Views)