From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why does my event structure run a single click when I double-click?

I would like to treat single-clicks differently than double-clicks but it appears that when I double-click an item on a Front Panel control it runs the single-click event once before running the double-click event.  I would like the single-click event not to trigger if the user double-clicks.
 
I am discarding the "Mouse Down?" filter event then using the "Mouse Up" notify event to try to catch the difference between a single-click and double-click.
 
Should I be doing something different with the timeout event (right now it does nothing)?
Should I stop displaying the event type?
Should I eliminate the 5 msec Wait in the Producer Loop?
Should I use the "Mouse Down" notify event instead of the "Mouse Up" notify event?
 
 
0 Kudos
Message 1 of 21
(4,635 Views)
If you edit the event cases, is the "Lock front panel until the case for this event completes" box checked?
0 Kudos
Message 2 of 21
(4,630 Views)

Yes, the "Lock front panel until the case for this event completes" box is checked.

I've also tried eliminating the output to the "Type" indicator that happened in each event.  That didn't fix it.

It appears as though the "Mouse Up" notify event is firing at the first click of the double-click as well as during the second click.

I'd hate to have to add a separate event for each of the boolean controls inside this cluster of controls -- there are over 150.  Do I need to change the order of the cases in my event structure to take care of the Double-Click event first or do I need to ignore the first "Mouse Up" event and handle the mouse clicking for that control in the "Timeout" event?

0 Kudos
Message 3 of 21
(4,609 Views)
it sounds like you're going to have to filter your mouse-up somehow.  you could also put the doubleclick event in a separate structure in a separate loop, or dynamically register the mouse-up so it doesn't fire on the double click.
0 Kudos
Message 4 of 21
(4,577 Views)
Hi,

This is indeed a big problem. Making this work is not going to be easy.

The reason you get a click before you receive a dubble click is kinda
obvious. The dubble click time could be set to 5 seconds, and you don't want
to wait 5 seconds before getting a click event if it isn't a dubble click.

The only way to work with both events is to build a timeout mechanism
yourself. Some ways to do this:

1) On click start a dynamic VI that is called again in the dubble click
event. If it's not called twice, it times out, and signals a value change
event.

2) Use the time out event. This can be tricky though. There is no guarenty
the time out case will fire (if other events keep on going).

3) Undoing the action started by a single click. This might not be possible.

4) Perhaps an XControl could be used. This will be very difficult, but your
main VI will stay clear.

Option 1 might seem intimidating, but isn't as hard as you might think. The
real problem can't be avoided though. You'll always get a click if you
dubble click, or you'll have to wait to be sure it isn't a dubble click.

Regards,

Wiebe.


0 Kudos
Message 5 of 21
(4,560 Views)

Something like this. It's kludgy, but shows the idea.

Note that you could replace the value change interaction with your own queue.

Hope it helps,

Wiebe.

0 Kudos
Message 6 of 21
(4,557 Views)

Did you try out with the Mouse Down event?

Or, you can execute the code only when the case is a Double-click.

- Partha ( CLD until Oct 2024 🙂 )
0 Kudos
Message 7 of 21
(4,544 Views)


@JeffOverton wrote:
If you edit the event cases, is the "Lock front panel until the case for this event completes" box checked?

I think this is a key configuration to understand.
The current configuration means that the 'mouse up' event for the first click is triggered. Then immideatly the front panel is locked. The second click needs to wait until the event has finished. So I think unchecking that box might improve the code.

Yes you should remove the 5 ms. wait, it has little purpose. It might even cause this: Click 1(& lock), wait 5 ms, event 1 (&unlock), click2 (no double click anymore).

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 8 of 21
(4,541 Views)
I have done some testing, but unfortunatly I couldn't get it solved like I thought.

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 9 of 21
(4,528 Views)

"parthabe" <x@no.email> wrote in message
news:1208513407329-691956@exchange.ni.com...
> Did you try out with the Mouse Down event?
> Or, you can&nbsp;execute the code only when the case is&nbsp;a
Double-click.

That won't help. He wants to execute some code on click, and some other code
on double click. If you use mouse down and double click event, both code
will be executed on dubble click...


0 Kudos
Message 10 of 21
(4,524 Views)