LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Detect mouse button

Solved!
Go to solution

Hi,

 

I'm trying to detect if mouse button is pressed. For now I have managed detecting mouse button status using Event Structure but my code inside loop is paused then. I would like to perform code inside while loop and to have one boolen indicator saying if mouse button is pressed or not. Code inside While loop must run all the time.

 

I have attached vi described above.

 

 

 

0 Kudos
Message 1 of 10
(5,999 Views)
Just put the event structure in a different loop
0 Kudos
Message 2 of 10
(5,990 Views)

hello...cant open your vi as it is in 8.6

 

can u post it in 8.5 version?

 

well when event structure is taken you can track the value change event of the button and at the same time code inside while loop can run.

 

i dont know what is there in your while loop but this is what i guess you want...

insted of or gate you will have your own code...

 

Message 3 of 10
(5,988 Views)

Thanks, but I'm not sure what have you try to show me with your code. I have very large project running inside while loop. I must be able to know if left mouse button is currently pressed or not. If you press left mouse button while hovering over plot or indicator, you will see LED turning ON  signaling pressed mouse button. My code inside while loop must run constantly regardles of mouse button status. I'll use information about mouse button state to disable only one small part of code inside my project.

 

Here is LV8.5 version.

 

 

Message Edited by _thomas on 11-05-2009 03:31 AM
0 Kudos
Message 4 of 10
(5,983 Views)

 

Pnt,

 

I'm not sure that is a option. I'm using sbRIO for signal acquisiton and I'm doing analysis and recording of signals. I think that while loop inside while loop is not a option in my case.

Message Edited by _thomas on 11-05-2009 03:37 AM
Message Edited by _thomas on 11-05-2009 03:37 AM
0 Kudos
Message 5 of 10
(5,979 Views)
Solution
Accepted by topic author _thomas

Hi,

 

you can use time out function.

 

ex attached below

Message 6 of 10
(5,974 Views)

The post before mentions to have another while loop running in parellel containing event structure to handle the user events.

 

 

Message 7 of 10
(5,974 Views)

Vsh wrote:

The post before mentions to have another while loop running in parellel containing event structure to handle the user events.


Exactly.

Two loops in parallel. One for the events for mouse and one for analysis and recording of signals.

The solution shrekt has given, is a bad one, allthough it may work.

It will slow down your loop, (for 10 msec will hung).

 

Message 8 of 10
(5,955 Views)

I have set timeout to 1 milisecond. I think it shoul be ok. I will also try using parallel loops.

 

 

 

0 Kudos
Message 9 of 10
(5,944 Views)

hi

 

i am working on a project to  use optical mouse as a distanced logging device that is i record the mouse position as the mouse moves along a path then I make a relation between the mouse couser position in pixel with length moved by body of the mouse in mm.

Every thing is OK when I use the mouse in short ranges ( 30- 40 mm) and the crusor is in the range of the monitor  but when I wana move it in about 1 meter or more which is out of the range of the monitor screen problem began :smileysad:

at the top of the monitor the position is fixed and it do not change anymore. For recording pixels greater than the vertical limit of the monitor I try to set the mouse position to a fix number to get the changes of the mouse position by set_crusor_pos.vi .

but it is not effective.

 

So I want to save the absolute changes of the mouse position even out of the range of the monitor e.i. if the mouse crouser is at the top of the monitor and if i move it upper I should record a movement in the up side direction.

I want to use my optical mouse a ruler to measure lengths in the range of 1-2 meter.

 

Many thanks

0 Kudos
Message 10 of 10
(5,625 Views)