LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Mouse Move event within IMAQ display not working?

Hi all,

I cannot seem to get a "Mouse Move" event to fire for mouse movement within an IMAQ display window. Reading other threads hasn't found a solution:
I downloaded the vi posted by Andrey in this thread, but it doesn't work.
I downloaded the vi posted by Bruce in this thread, and although it works, it's incredibly slow.

I based my own vi on the Dynamic Event Registration nugget, here, that registers and de-registers events to help reduce CPU wastage, but for IMAQ windows the Mouse Move event doesn't seem to fire? I've attached my code, please take a gander and tell me if I've got something wrong here.

I'm using LabVIEW 7.1, Vision 8.2.1 on Win2000Pro.

Thanks in advance for any help Smiley Happy

Riggy.
0 Kudos
Message 1 of 6
(3,104 Views)
I've played around with the vi a little more and I've realised that the Mouse Move event doesn't fire whilst the mouse button is being held down.
Unfortunately, this is exactly what I need. I don't want the mouse move event to fire if the mouse just happens to be passing over the image, I'm only interested whilst the mouse button is being pressed. That's why I'm using the dynamic registering of events functions, to prevent the code from running away too much and restricting the event case to fire only if the mouse moves when the user has the mouse button down. Anyone any ideas why the Mouse Move event doesn't fire though? I mean, afterall, the mouse is still moving Smiley Indifferent
Riggy Smiley Sad
0 Kudos
Message 2 of 6
(3,093 Views)
OK, more info, and still very confusing. If I run the vi and don't load an image into the IMAQ display, the event structure runs perfectly. I can press the mouse button down in the display, move it around and see the coordinates being updated whilst the pointer moves, then let go of the mouse button. But, if there's an image there in the display, the vi stops responsing properly and fails to notice mouse movements anymore.

So, why does the event case Mouse Move only work when the IMAQ display is displaying no image?

Anyone??? Smiley Indifferent
0 Kudos
Message 3 of 6
(3,088 Views)

Hi Riggy,

I hope you are doing well today! There was a corrective action request filed for LabVIEW 7.1 (CAR ID# 3EQFLQZN) with respect to this. Since you didn't post an example code, I created my own and can confirm this behavior. But, this seems to have been fixed from LabVIEW 8.0 onwards. So, I would recommend that you download the most recent version of LabVIEW. You might first consider downloading an evaluation version at LabVIEW 8.5 Evaluation Software Download and trying it on there. I have attached example code. Let me know if it was not what you were trying to communicate.

 
Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 4 of 6
(3,077 Views)
Hi Adnan,

I did post an example code, its in my initial message. Your example is not quite what I'm trying to achieve. I have the mouse move event dynamically registered such that I can register and de-register it at will. To conserve CPU, I have it de-registered until the mouse button is pressed within the image window. While the mouse button is pressed, the mouse move event needs to work, reporting the mouse coords whilst the user moves the pointer about. Once a Mouse Up is detected the mouse move event is de-registered again. You can see an attempt for this in my example code (see top of thread).

The problem I'm encountering, as you identified, is the Mouse Move does not fire whilst the mouse button is down. It will certainly fire, as in your example, if the mouse is simply moved across the image, but once the mouse button is pressed, the mouse move event fails to work. This is true also in your code.

I do have LV 8.0, but I develop code for a broad spectrum of users, some of whom have only recently upgraded to 7.1, so I can't use LV 8.0 for this particular app. I need a work-around.

Any thoughts?

Riggy.
0 Kudos
Message 5 of 6
(3,069 Views)
I thought I'd update this thread in case anyone else searches for the same thing, and attach the following library. It is my current workaround to the problem.

Given that the Mouse Move event will not fire with the mouse button down, I instead switch a boolean flag to true. This boolean causes a case to run in the event timeout frame. Within the case, relevant calculations are performed to convert the Mouse Coordinates, as read via the device interaction functions, into front panel coordinates and a check is performed to see if these are within the IMAQ display image. Once the mouse moves outside the frame or the mouse button is released, the boolean is reversed and the mouse coordinates are no longer monitored.

It seems to be a messy but workable workaround to the 7.1 issue as identified above.

I hope this might be helpful to someone Smiley Wink

Riggy
0 Kudos
Message 6 of 6
(3,054 Views)