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

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

Post by Erik Ooste » Fri, 18 Apr 2008 04:10:06

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?
 
 
<img src=" http://www.yqcomputer.com/ ">

 
 
 

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

Post by JeffOverto » Fri, 18 Apr 2008 04:10:08

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

 
 
 

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

Post by Erik Ooste » Fri, 18 Apr 2008 06:10:07

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?
 
 
 

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

Post by JeffOverto » Fri, 18 Apr 2008 21:40:05

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.
 
 
 

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

Post by Wieb » Sat, 19 Apr 2008 18:30:44

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.
 
 
 

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

Post by wieb » Sat, 19 Apr 2008 18:40:04

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.


Single Dubble Click.zip:
http://www.yqcomputer.com/
 
 
 

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

Post by parthab » Sat, 19 Apr 2008 19:10:07

Did you try out with the Mouse Down event?
Or, you can execute the code only when the case is a Double-click.
 
 
 

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

Post by TonP » Sat, 19 Apr 2008 19:40:05


 
 
 

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

Post by TonP » Sat, 19 Apr 2008 21:10:08

I have done some testing, but unfortunatly I couldn't get it solved like I thought. Ton
 
 
 

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

Post by JeffOverto » Sat, 19 Apr 2008 22:40:07

it wouldn't be fun, but in your mouse up event, you could check the coordinates of the event and discard it if they fall within the listbox
 
 
 

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

Post by Wieb » Sat, 19 Apr 2008 22:47:20


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...
 
 
 

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

Post by Wieb » Sun, 20 Apr 2008 00:58:01


coordinates of the event and discard it if they fall within the listbox

How would that help to distinct between single click and double click?
 
 
 

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

Post by JeffOverto » Sun, 20 Apr 2008 01:40:09

the double click is only in the listbox, I would assume.  there's no pane doubleclick event, only control doubleclicks.  so if the coordinates of the single click were in the list box, you could just ignore most of the event actions, I would think.
 
edit - this would have to be in the situation where he has a separate event structure for the doubleclick, otherwise the single clicks would still take precedence, I think.Message Edited by JeffOverton on 04-18-2008 12:31 PM
 
 
 

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

Post by tbob » Sun, 20 Apr 2008 02:10:09

Since Labview cannot distinguish between a single click and a double click, it might be best to re-think the action required.  Instead of single-double clicks, it may be best just to choose another method for running the separate codes.  Maybe two buttons would do.  One button runs the single click code, the other runs the double click code.  Maybe a switch to choose which code executes when the single click is performed.  Changing the required action would be easier than creating cludgey code to act on double click without firing the single click event.
 
 
 

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

Post by Ravens Fa » Sun, 20 Apr 2008 02:40:08

One thing I haven't seen mentioned in this thread is that the mouse down and mouse down? events have a Mods.Double Click property that can be read by way of the properties within the event structure.  ???
Are there any problems with using that?
<img src=" http://www.yqcomputer.com/ "> Message Edited by Ravens Fan on 04-18-2008 01:31 PM


Example_VI_BD3.png:
http://www.yqcomputer.com/