From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Recording multiple mouse clicks on a 2d picture

Solved!
Go to solution

Hello

I've been fiddling around with the idea of making a program for the Chaos Game, and in this program I want the user to be able to choose the shape of the polygon, instead of only using "perfect" polygons (eg. triangles with 120 degree corners, squares with 90 degree corners and so on). I've hit a little bump as to how to record the custom vertices. I thought that using the Mouse Down event in an Event Structure would do the trick nicely, but the program freezes up after it records the first vertex (1 click on the 2D picture).

 

I've centered the program around a State Machine, which has the following states:

Initialize - Setup picture size (only thing in there so far)

Setup Polygon - Record when the user clicks on the 2D picture

Get start point - Record the starting point for the algorithm via a mouse click on the 2D picture

Run algorithm - Runs the Chaos Game algorithm

Pause algorithm - Pause state where the user can either click a "Run", "Reset", or "Stop" button

Reset picture - Resets all the variables in the program and brings the user back to the Setup Polygon state

Stop - Speaks for itself

 

I haven't implemented the algorithm itself yet, it's just about getting the mouse clicks working, so any help regarding that (and any other ideas for the program for that matter) would be much appreciated.

0 Kudos
Message 1 of 3
(2,519 Views)

You have event structures buried inside case structures.  Generally a bad idea.  One of the two is set to lock the front panel until it completes, and both are set for Mouse Down on the picture.  So if you mouse down, but the path of execution doesn't go into that case naturally, it won't execute and the front panel will remain locked.

Read:

Caveats and Recommendations when Using Events in LabVIEW - LabVIEW 2016 Help

Message 2 of 3
(2,508 Views)
Solution
Accepted by topic author Icytroll

Thank you for that explanation RavensFan.
I ended up solving my problem by using the Mouse modifier - Button down property node from the 2d picture. There was only a small problem with it, in that the boolean from the the button down node would stay true for way longer than i needed when i just clicked once on the picture, so I ended up only detecting the first true from said boolean with a rising-edge detector.

0 Kudos
Message 3 of 3
(2,429 Views)