LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

problem using state machine with structure event (mouse clicking)

Hi,
 
I use state machine sequence, but I have a problem with using event structure. I want this structure to handle click on the mouse.
But it doesn't work, the vi bugs. When I use the function timeout of the event structure, it works.
I don't know why?   
I send here the vi.
 
Thanks for your help. 
 
 

Attachment paint renf.zip (837 kb)

0 Kudos
Message 1 of 19
(2,345 Views)
0 Kudos
Message 2 of 19
(2,307 Views)
Hi
I can't execute your code, it seems to miss some files. What do you want to do exactly? Can you explain your problem with a simple example???
What event tdo you want to associate at the mousse click??

Kamal
NIF
0 Kudos
Message 3 of 19
(2,297 Views)
Sorry, I think it will work now.
 
I want to use state machine architecture with event structure.
 
The user clicks on a picture and another event occurs (for example a beep).
If he clicks on another picture, another event occurs (5 second dark screen displayed).
 
There is always display of two pictures, simultaneously and the user has to click on the good shape (for receiving the paint program and avoiding the dark screen)
 
There is before, a 5 second or 0.5 seconds displaying of a red rectangle, but it is not the problem, here.
My problme is using correctly event structure with mouse clicking event.    
 
I hope that is more clear.
0 Kudos
Message 4 of 19
(2,288 Views)
I think a big part of your problem is the multiple event structures. If you were to right click on an event structure and select Help, one of the linked topics in the hlpe file is "caveats and recomendations for using events". One of the caveats is "Avoid placing two event structures in one loop". By my count, you have 8 and you are handling the same events over and over again. It's a little unclear to me what exactly you are trying to do but the current method will not work. Maybe you want to avoid the event structure completely.
0 Kudos
Message 5 of 19
(2,276 Views)

nousome,

 

From the sounds of it, a possible solution for your application would be to use the Position property node for the two pictures that you are looking for mouse clicks on.  You would then only need one event structure.  Then using either Mouse Up or Mouse Down events, get the coordinates of where on the front panel the mouse was clicked and compare them to where your picture positions are (you will have to get the size of your pictures as well).  If they are in the range of picture 1, do action 1, if the coordinates are in the range of picture 2, do action 2.  If the user didnt click on either of them no actions are taken.

Hope this helps,

Quintin

0 Kudos
Message 6 of 19
(2,270 Views)
Yes, thanks for the idea but the problem is that the side is not always followed by the same event. The "good picture" is either at left either at right, so it seems impossible to write only one event structure. 
0 Kudos
Message 7 of 19
(2,263 Views)

Yes, I have read this topic. Certainly it is the reason, but I don't know how to avoid event structure in this case.

In fact, with the two pictures you see in bottom, one is good (S+ and is followed by paint application) and the other is wrong (S- followed by dark screen). The position of the good shape and bad shape is once at left, once at right.

0 Kudos
Message 8 of 19
(2,258 Views)
So the actions occur once the user clicks on the right picture then the left picture or vice versa?  If thats the case you could use shift registers to keep track of the last mouse click, i.e. a numeric coded 0 - no mouse click, 1 - mouse click not on either picture, 2 - mouse click on left picture, 3 - mouse click on right picture.  So now you look for a 2,3 combination or a 3,2 combination.
0 Kudos
Message 9 of 19
(2,252 Views)

Sorry I have responded too quicly, and I am wrong. It is good idea. I had also the idea of alternating position of picture control (not visible here because the code is not complete) to accomodate with one picture: contains always the good picture and the other always the bad.  

But I have not thought that I don't have to write several times the event structure.

0 Kudos
Message 10 of 19
(2,249 Views)