10-20-2017 02:27 PM
Much like a string where you can right click it and enable "update value while typing," is there a way to do the opposite on a DBL slider where it doesn't update until you've released it?
10-20-2017 02:36 PM
Not that I know of. Under what conditions would you say you are done sliding? After a certain amount of time has passed since the last slide?
But suppose you use the timeout event to your advantage. Wire a timeout value the current value of the slider into a shift register. Set the timeout of the event structure. When the timeout event occurs, you know some time as passed. Use the last value of the slider from the shift register to do what you want. Wire a -1 to the shift register to disable the timeout event of the event structure (until the next slider value change event occurs.)
10-20-2017 02:44 PM
I'd say you're done sliding when you "release" the slider. So I guess it'd be a mouse event. But it's the same thing as any other number. How does LabVIEW know you're done entering a number? You click outside of the control or press 'enter' (assuming enabled).
And I see where you're going with your suggestion. Unfortunately, not doable in this application. Too far down the rabbit hole.
10-20-2017 02:46 PM
Often it helps to limit the number of events to 1. This won't do what you're asking for, but might solve the same problem. Usually the problem is handling the events take some time, and his causes a lag. So you move the slider around, and the events are handled unil long after your done. Limit the number of events, and you won't get this problem.
You might be able to misuse the mouse up event. Set a Boolean to true in the value change event, and if the Boolean is true, do your handling when you get a mouse up and set the Boolean to false. The Boolean trick also works with the mentioned time out event, if you need to handle more then one slider.
I think you should be able to use the flush events function, but can't test that on my tablet. It will have to wait to Monday.
10-20-2017 02:48 PM - edited 10-20-2017 02:50 PM
[POST COLLISION!]
I was typing mine while weibe was posting his. But we are on the same page with Mouse Up purging the event queue!
Throwing out some ideas...
In recent version of LV you can purge the event queue. The event has a time stamp that may help.
Another approach would use mouse up and down on the slider and only get the slider value on a Mouse Up not on a Value change.
Ben
10-20-2017 03:05 PM
The simple, not quite exactly what you are requesting, is to just limit the number of events to have in the event queue. You can set it in the Edit Event dialog.
If you are just polling the value via the terminal, then you cannot do anything. Feel free to add it to the Idea Exchange.
10-20-2017 03:09 PM
@Ben wrote:
[POST COLLISION!]
I was typing mine while weibe was posting his. But we are on the same page with Mouse Up purging the event queue!
Throwing out some ideas...
In recent version of LV you can purge the event queue. The event has a time stamp that may help.
Another approach would use mouse up and down on the slider and only get the slider value on a Mouse Up not on a Value change.
Ben
This would also be difficult to do. Consider this:
I suppose there may be some way to lock the mouse coordinates to the bounds of the control while the mouse button is down, maybe using a call to user32.dll. That would get quite messy.
10-20-2017 03:11 PM
@aputman wrote:
@Ben wrote:
[POST COLLISION!]
I was typing mine while weibe was posting his. But we are on the same page with Mouse Up purging the event queue!
Throwing out some ideas...
In recent version of LV you can purge the event queue. The event has a time stamp that may help.
Another approach would use mouse up and down on the slider and only get the slider value on a Mouse Up not on a Value change.
Ben
This would also be difficult to do. Consider this:
- you mouse down on the control
- move the mouse outside of the control
- release the mouse outside of the control
- event will not fire
I suppose there may be some way to lock the mouse coordinates to the bounds of the control while the mouse button is down, maybe using a call to user32.dll. That would get quite messy.
I think there is also a "mouse leave" event.
Ben
10-20-2017 03:13 PM
You have to be careful about one thing with the Mouse Up event.
If you have moved the mouse off the slide at the time you Mouse Up, the mouse up event for the slide will not fire. You will have effectively changed the value of the slide, but the mouse up event won't happen to detect that you are done moving the slide.
10-20-2017 03:36 PM
@RavensFan wrote:
You have to be careful about one thing with the Mouse Up event.
If you have moved the mouse off the slide at the time you Mouse Up, the mouse up event for the slide will not fire. You will have effectively changed the value of the slide, but the mouse up event won't happen to detect that you are done moving the slide.
Good point well made. I forgot how annoying that is. Sure can make your head hurt from time to time.