LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DBL Slider - prevent update until done sliding

Why use Mouse UP when you can use Mouse Enter?  I suppose the Event would be Mouse Enter... and then would prevent code as long as the DBL is changing? 

 

I feel like I may not be understanding fully what Mouse UP is

0 Kudos
Message 11 of 30
(1,467 Views)

Mouse Up would accomplish what you originally requested:

"doesn't update until you've released it?"

But as has been pointed out, there are other scenarios where that doesn't work.  Another scenario is where you mouse down outside of the slider, move the mouse into the slider bounds and then release the mouse.  The value isn't changing but a mouse up event will fire.  

 

I think the solution to your problem is don't use a slider where continuous value change events can't be handled properly.  

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 12 of 30
(1,458 Views)

Mouse enter: mouse hovers above the control for the first time.

Mouse up: mouse button is released while above control.

Mouse leave: mouse leaves the control area.

 

So forget about mouse leave. It doesn't do what you want, or is way to complex to get it to do what you want. Note that even when you are moving the slider, there is no guarantee you ever get a mouse up event. And that you might get a mouse up event, while no value was changed (click on anywhere on panel, move while pressing mouse button above control, release button) will trigger the event.

 

In retrospect, not useful.

0 Kudos
Message 13 of 30
(1,454 Views)

I have not had good luck in limiting the event queue. Sometimes the event would fire and clear the queue before the next event occurred. On my timescale the events seemed continuous, but the the CPU timescale they were counted as discrete.

 

Something like below worked for me. You can change the time between events value, here 100 ms.

 

Snap1.png

 

 

There is a slight edge case with this method, if the timer value has wrapped around and is less than 100, then the first event will not occur.

 

mcduff

0 Kudos
Message 14 of 30
(1,450 Views)

@mcduff wrote:

I have not had good luck in limiting the event queue. Sometimes the event would fire and clear the queue before the next event occurred. On my timescale the events seemed continuous, but the the CPU timescale they were counted as discrete.

 

Something like below worked for me. You can change the time between events value, here 100 ms.

 

Snap1.png

 

 

There is a slight edge case with this method, if the timer value has wrapped around and is less than 100, then the first event will not occur.

 

mcduff


That won't give you events if they happen within 100ms. So when moving rapidly, you won't get any message except the first.

 

0 Kudos
Message 15 of 30
(1,442 Views)

Use Dynamic events.

Register for Mouse enter.

Then dynamically register for mouse down mouse leave and unregister mouse enter.

When mouse down happens then register for mouse up.

When either down or leave fire unregister for those and then reregister for mouse enter.

 

See the nugget by Ton to learn how to use dynamic events.

 

Ben

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 16 of 30
(1,442 Views)

@Ben wrote:

Use Dynamic events.

Register for Mouse enter.

Then dynamically register for mouse down mouse leave and unregister mouse enter.

When mouse down happens then register for mouse up.

When either down or leave fire unregister for those and then reregister for mouse enter.


Wouldn't you still be able to make value changes when mouse leave has occurred? When mouse is still down and grabbing he slider thingy.

 

LV could really use a few more event. Look at gtk for examples. Lost capture and such...

0 Kudos
Message 17 of 30
(1,437 Views)

For my case, that is what I wanted. I decimated an array based on the plot size, if someone was rapidly resizing the window, a backlog of decimations would occur.

Basically the first and last event would get register. (For example, someone grabbing the side of the window, resizing it back and forth, and then finally letting go.)

 

For other use cases, change the value to whatever you need for your program.

 

mcduff

0 Kudos
Message 18 of 30
(1,435 Views)

wiebe@CARYA wrote:

@Ben wrote:

Use Dynamic events.

Register for Mouse enter.

Then dynamically register for mouse down mouse leave and unregister mouse enter.

When mouse down happens then register for mouse up.

When either down or leave fire unregister for those and then reregister for mouse enter.


Wouldn't you still be able to make value changes when mouse leave has occurred? When mouse is still down and grabbing he slider thingy.

 

LV could really use a few more event. Look at gtk for examples. Lost capture and such...


Yes so disable the slider when you leave?

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 19 of 30
(1,431 Views)

@Ben wrote:

wiebe@CARYA wrote:

@Ben wrote:

Use Dynamic events.

Register for Mouse enter.

Then dynamically register for mouse down mouse leave and unregister mouse enter.

When mouse down happens then register for mouse up.

When either down or leave fire unregister for those and then reregister for mouse enter.


Wouldn't you still be able to make value changes when mouse leave has occurred? When mouse is still down and grabbing he slider thingy.

 

LV could really use a few more event. Look at gtk for examples. Lost capture and such...


Yes so disable the slider when you leave?

 

Ben


That might work, but it would be very inconvenient for the user. When you grab the slider, it hard to move it left and right and stay perfectly horizontal while doing that.

0 Kudos
Message 20 of 30
(1,395 Views)