LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Slide with multiple Digital Displays Key Down Filter Event Bug?

Solved!
Go to solution

A Key Down Filter Event on a Slide with multiple Digital Displays doesn't work as expected when not discarded. If you want to e.g. tab from a Digital Display of this Slide with two Digital Displays, the Cursor stays on its position, instead of moving KeyFocus to the next Control. Same wrong behavior if you want to move the cursor by keyboard Keys Left/Right, nothing happens. Has anyone an idea why?

 

A simulation vi is attached. From all other controls, a Slide with one Digital Display or from a standard Digital Control, the Key Down Filter Event behaves as expected... I tested in versions LV 8.5.1 (attached file), LV2012SP1 and LV2013.

0 Kudos
Message 1 of 10
(3,430 Views)

You're using two events for each slider.  That's what's causing your problem.  Getting rid of either the Key Down or Key Down? event for both sliders solves the problem.  Never use more than one event for a control.

Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
0 Kudos
Message 2 of 10
(3,409 Views)

Thanks Bersch for your thoughts. I guess you didn't try it out when saying that. Attached the same test file without the Key Down Notifier Event. You say "getting rid of either the Key Down or Key Down?", from what I used and heard so far - and I'm working with Events a lot - I never heard such a thing... Notifier and Filter Event have both their own functionality and you need some times both of them, one to prevent the effect of an event, and the other one to react after an event has occurred. Not being able to use both would sound to me as a bug...

0 Kudos
Message 3 of 10
(3,388 Views)

Hi DavidZ

 

I have joined in this mail a link to understand the difference between Notify and Filter Events, please referred to it.

 

http://zone.ni.com/reference/en-XX/help/371361J-01/lvconcepts/notify_and_filter_events/

 

About your problem, I add in your second VI a minor change to be able to focus other items, respecting your specifications. I just check if the pressed touch is Tab (=9) or not.

 

However I suggest you not to use a double slide to build a range but simply a maximum and minimum value (for temperature for example).

 

Have a nice day

Certified LabVIEW Architect (CLA)
0 Kudos
Message 4 of 10
(3,375 Views)

I noticed your problem when I first loaded the VI and tried several things.  Nothing seemed to help until I removed both Key Down events for the sliders  At that point everything worked perfectly.  With the new VI you attached it is back to not working.  It must have been something else I did as well.  I'll look again.

 

You can use the filter event just like a notifier event.  If you don't discard the event then it functions like a notifier event.  I cannot imagine a scenario where I would need both.

Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
0 Kudos
Message 5 of 10
(3,365 Views)

This is looking like a bug in the slider control.  If you don't show the digital displays the numeric field of the second display will appear when you try to tab from the first slider to the second slider.  That is not proper functionality.  The problem only manifests with the Key Down? filter event.  The Key Down notifier event doesn't present the problem.  It looks like the tab key is moving the focus from the first slider to the second slider, which is good functionality, but the second digital display doesn't get highlighted as it should.  The problem seems to come after that and it takes a small amount of time.  If you hold the tab key so the Key Down fires continually then the focus changes as it should.  I tried it with sliders from the modern, classic, and Silver palettes and the problem is present in all of them.

 

I tried adding a third slider and things got even weirder.  If the digital displays are visible the problem is just the same, when I tab from the first to the second slider the second slider is highlighted but if I use the mouse wheel or cursor up/down the first slider is highlighted again and moves.  I cannot tab to the third slider.  If the digital controls are not visible the rnumeric field of the second slider does not appear when I tab to it from the first slider, however the numeric field of the THIRD slider appears when I try to tab from the second slider to the third slider.

Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
0 Kudos
Message 6 of 10
(3,357 Views)

To Jean,

thanks for your message and your modified vi. (I backsaved it to lower LV version 8.5.1 and attached it again.) Hm, the KeyFocus property is already an idea. Though in a slider with more than one Digital Display a user wants to tab first from one Digital Display to the next Display of the same slider, until tabbing to the next control. And then with the KeyFocus there is only the Tabbing solved, but not any other key as typing a number into the control.

You send the generic NI help page, do you think my short resumé was not accurate? 😉 "...Filter Event to prevent the effect of an event, and the Notifier Event to react after an event has occurred..."

 

To kbbersch,

I wonder how it could have worked just with the Key Down Notifier event removed, I can't reproduce that. Do you have it saved? If ever, could you post it?

About removing the Digital Displays of a slider and and tabbing then to the slider, I could reproduce the "phantom" Display showing up and it is indeed a very strange behavior!!

About using both filter and notifier events together, you may not imagine a scenario, but there are and I'm working with that from time to time in more complex user experience stuff as e.g. handling Mouse events on a Graph with different sections. You want to prevent some Mouse Down event (Filter) in certain zones of a Graph, react on some Mouse Down (Notifier) in another zone and this works perfectly as expected...

0 Kudos
Message 7 of 10
(3,342 Views)
Solution
Accepted by topic author DavidZ.

A team-mate found now a solution or workaround. We're not sure whether it's the way it should be, if yes, then it's a bit hidden, but it works!

 

It seems the slider needs to know on which Digital Display the FocusObj is when using the KeyDown Notifier Event. So when getting the reference of the active Digital Display and wiring this reference to the Filter Event terminal FocusObj everything works as expected, Tabbing, typing digits, cursoring etc and having both Filter and Notifier events in the Event structure.

 

A vi and printscreen are attached.

 

The whole issue is probably due to the speciality of Slides and the class NumericWithScale in general, as its Digital Displays are kind of sub-references and when implementing some KeyDown Event Filter functionality for the NumericWithScale class, LV simply doesn't know on what sub-part of the main control the action should be executed.

 

Or does anyone have a better solution and explanation?

Message 8 of 10
(3,335 Views)

To me this looks like a bug. As soon as we use the Key Down Filter Event the focus object seems to change from the digital display to the slide control itself, so the actual Key Down is then executed on the Slide instead of the digital display.

The workaround is to make sure the focus object for the Key Down is still the digital display, not the slide control.

 

0 Kudos
Message 9 of 10
(3,323 Views)

Even that this looks like a bug I accept wiring the Digital Display reference to the FocusObj Filter Event Terminal as a solution. Who knows whether this will be fixed one day...

0 Kudos
Message 10 of 10
(3,252 Views)