LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

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

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
0 Kudos
Message 11 of 21
(1,586 Views)

"JeffOverton" <x@no.email> wrote in message
news:1208526007853-692085@exchange.ni.com...
> 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

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


0 Kudos
Message 12 of 21
(1,577 Views)

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
0 Kudos
Message 13 of 21
(1,574 Views)
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.
- tbob

Inventor of the WORM Global
0 Kudos
Message 14 of 21
(1,569 Views)

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?



Message Edited by Ravens Fan on 04-18-2008 01:31 PM
0 Kudos
Message 15 of 21
(1,563 Views)


@Ravens Fan wrote:

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?


Message Edited by Ravens Fan on 04-18-2008 01:31 PM

Yepp,
and that's just the core of this discussion.
If you have an event structure, with a mouse (up or down) event. And you create a boolean indicator for the Mods.DoubleClick property.
You will see the following:
For every double click the boolean goes true.
If you do a consequitive double click (twice in a row), you will see the boolean go false on the first click of the second double click.
The only thing I can think of is Wiebe solution.
Set a notifier to NOT'Mods.DoubleClick' (true for single clicke, false for double click), in a second loop wait for the notification, if the notification is 'T', wait again with a certain timeout (50 ms or so). if the second read doesn't time out you have a double click:

If somehow the 'False' state is called you missed the 'first click'.

Ton


Message Edited by TonP on 04-18-2008 08:10 PM
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 16 of 21
(1,550 Views)
Has anyone else looked at the VI I've posted?

Regards,

Wiebe.


0 Kudos
Message 17 of 21
(1,530 Views)

I know this is a somewhat old thread, but I wanted to make the point that a better solution is to (when possible) conceptually define the single-click action as a subset of the diouble-click action. For example, single-clicking an item in a list selects it, while a double click selects and activates it. With this structure, the single click is fired - but it doesn't matter.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 18 of 21
(1,371 Views)

I know this post is old but, since I had the same problem without finding a satisfactory solution on this forum, I implemented one by myself and I post it here for anyone who maybe will needs it in the future. ;)

0 Kudos
Message 19 of 21
(1,062 Views)

@Helpdesk85 wrote:

I know this post is old but, since I had the same problem without finding a satisfactory solution on this forum, I implemented one by myself and I post it here for anyone who maybe will needs it in the future. ;)



Hi,

 

This example could work for you. There are some caveats that you might be aware of (I haven't looked at the other solutions, they might have the same caveats)...

 

There is a potential race condition. You set "Single" to true, but there is no guaranty it happens before setting it to false (in the OK Button mouse down event case). That is easy to fix by wiring the error out of the first property node. Leaving it like this, it might work fine, and then it stops working without any apparent reason.

 

It only works when the time out case actually triggers. If you add events, like a mouse move event, it doesn't work anymore when the mouse moves, since the time out event isn't triggered. The TO event is also not triggers when you continously click or double click the button. You can solve this by using two event structures (one in a sub vi, with only a TO, mouse down and stop event).

 

The 300 ms time out is arbitrairy. A user can set windows to use a double click interval of 2 seconds, or 50 ms. I think the only way to avoid this is to read the double click interval time with a windows API call...

 

So, if it works, use it. But still no satisfactory solution if you'd ask me.

 

Regards,

 

Wiebe.

 

 

 

 

0 Kudos
Message 20 of 21
(1,051 Views)