LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

key down event fires mouse down

Here is something very strange.
 
I have an event structure that handles Mouse Down? for several buttons and Key Down? for the VI (among other things).  The Key Down? handler looks at what was pushed and usually just passes it along without taking any action.  Now, strangely, if I push a key after having clicked on a button, if the event handler passes it along then the previously clicked button will get another Mouse Down event.  This works for any button, both those handled by the event structure and those which aren't, and for any key.  If the Key Down? event is discarded, then the Mouse Down event isn't fired.  If I step through, I see the key down event walk through and then immediately the Mouse Down event happens, as if I had just pushed a button.  The source is "LabView UI" and the time is identical to the time of the key down event.  This even happens if I have put focus into something else in between the actions.  For example:
1) Push "GO" button
2) Click in a string control to enter some text
3) Press a key
They key pressed will NOT appear in the string control, but instead the GO button will get a mouse down event.  If I press the key a second time, again it won't appear in the string control, but the button won't get another mouse down.  A third key press will finally go into the string control.  I monitor the focus object in my key down handler, and it is what its supposed to be (in this case, the string control).  And again, this works for any button, and any intermediate control (I've done numeric, string and "nothing").
 
Maybe the most frustrating part of this is that I spent quite a while trying to figure out how to programmatically fire a mouse down event and couldn't find a way to do it.  Now I can't turn it off.
 
I'd love to attach the code, but its part of a huge application that uses hardware so its a bit unwieldly to attach. 
 
Thanks in advance for any helpful advice,
Eric
 
0 Kudos
Message 1 of 6
(3,795 Views)

Instead of programatically firing a mouse down event you can have the mouse down event fire a user defined event and then fire the same user defined event when needed.  You will have to have LV 7.0 for user events to work.

 

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 2 of 6
(3,782 Views)
> Instead of programatically firing a mouse down event you can have the mouse down event fire a
> user defined event and then fire the same user defined event when needed.  You will have to have
> LV 7.0 for user events to work.
 
Yep, that's what I ended up doing (I'm using 7.1).  Any idea what is making the Mouse Down event fire now though?
0 Kudos
Message 3 of 6
(3,777 Views)
I tried to recreate this and couldn't. I suggest you do try cutting that code out of your app, leaving just a small VI, and see if the problem still exists. From your description it does sound like a bug, but without being able to reproduce it, I doubt the report will be of any help.

___________________
Try to take over the world!
Message 4 of 6
(3,756 Views)
Can somebody describe how to make a mouse down event fire an user-defined event?  I too have been trying to figure out how to programatically fire a mouse down event with no success.
0 Kudos
Message 5 of 6
(3,509 Views)
It's been a while since I was thinking about this, but I think the point was that you can't actually programmatically fire a mouse down event.  Instead you can just capture mouse down events and have them fire a user event and then if you wanted to programmatically fire a mouse event you'd just directly fire the user event.  Hope that makes sense.
0 Kudos
Message 6 of 6
(3,499 Views)