03-08-2011 11:17 PM
Hopefully this will clarify my problem: I want to be able to draw on the picture and then when you release the mouse, the while loop stops and the program ends. I use shift registers to count the number of boolean changes of the mouse button down and then stop the while loop after that. The problem I run into is when the "Select JPEG file to load" dialog is over the picture it counts the boolean change of when I am clicking on the JPEG file. I would like the program to stop when you release the mouse after drawing on the image whether or not the file open dialog is over the picture or not. Sorry if this is confusing. I am fairly new to LabVIEW and this is likely not the best way to solve this problem so any help would be appreciated. I have attached the program that I am using now.
03-08-2011 11:28 PM - edited 03-08-2011 11:29 PM
It works okay for me if I click on the picture in the dialog box and then click OK.
However if I double click on the file in the dialog, then the VI ends early.
Are you actually talking about double clicking when you say you are clicking on the file in the dialog?
What you may want to do is set up the event as a user event that you don't actually register for until after the reading from the JPEG file has occurred.
03-09-2011 12:09 AM
I couldn't get a user event easily figured out for this. But I did realize the problem is that the double clicking was causing a mouse move event to occur and get queued up before you ever go to the event structure.
So I established a scheme that would clear out any pre-existing. Until the 1 millisecond timeout event has had a chance to occur, the incrementing code can't run. Once it has occurred, you know the pre-existing events have cleared out. Now you can reset the timeout to -1 (infinite timeout) and use that as a flage to determine when you can start counting button changes.
03-09-2011 12:25 AM
Yes, the problem is when I double click the file in the dialog it ends early. Is there any way you can post your modified VI as an earlier version? I am running version 9 and unable to view. A image of your schematic changes would work also? Thanks.
03-09-2011 08:37 AM
Here is LV2009.
03-10-2011 09:18 PM
Here is what I was trying to do earlier when I talked about registering the events. I think I was getting the terminology of User Events vs. Dynamic Events confused.
With this, you don't register for the Mouse Move event until after the file has loaded, that way mouse move events when the file dialog box is open aren't getting captured.
03-14-2011 09:39 AM
Thanks a ton. This works well. I wasn't able to build a program that utilizes this concept from scratch but when I built off of yours it worked fine. Is there anything I need to do to get the Dynamic Event Registration working?
03-14-2011 11:13 AM
The key things are getting the event registration terminal to show by right clicking on the border of the event structure. And get the control references connected to the proper input of the Register event node.