LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI is freezing

I am using an 1 event stucture inside a while loop to capture mouse movments and related items.  The first thing I do is load a picture and display it on the screen.  Next I would like to be able to zoom to an area (using the zoom property node) and then also be able to pan the picture left/right, up/down (again using the horizontal/vertical display property nodes).  This is what I had done to accomplish this task. 

I used a sequence structure and placed the loading of the picture in the first frame.  Following this I placed the zoom and scrolling functions in the second frame.  These functions were inside a while loop with the condition terminal wired to a boolean control.  The last sequence frame consisted of an event structure with the commands for the mouse. 
 
Upon running the VI, the user would select the picture, and be able to zoom and pan to an area, and then select this area and have the subset of the original picture show up in a seperate display box.  The problem I am having is that when I try to either zoom or pan it works fine, if I try to zoom and then pan (both functions) then the program locks up.  I have tried using a small time delay inside the while loop (10-200 mS) without and success.  Does anyone have an idea what could be going on here?  I used the sequence structure because the event/state machine structure triggers on mouse movements so any time I move the mouse it will try to execute the event code.  I placed the other features in a sequence to guarentee that they will execute first without fear of the event structure activating.  Any help???
 
Kirk
0 Kudos
Message 1 of 4
(2,844 Views)
It would really help if you could post your VI as it's a bit difficult to picture (no pun intended) what you're doing.
0 Kudos
Message 2 of 4
(2,838 Views)

The first thing that happens when you run the VI (Subset Creator2.VI) is it will ask you to load a picture.  This must be a .bmp! Then try using the zoom and or pan left right, up/down controls. This is where it freezes up.  If you can get passed this part, press the accept zoom button and you should then be able to click and drag on the original picture to select a specific area.  Upon releasing the mouse button the subset should appear below the main picture.  Another thing I noticed was that when you go to select the area, the beginning of the selection begins at a point not where your mouse is located.  Not sure why it is doing this all of a sudden either?? Give it a try!! Thanks!!

 

Kirk

0 Kudos
Message 3 of 4
(2,830 Views)
Well, I made a few changes to your VI which is a little cleaner and, I believe, a little easier to read:
  • Eliminated the sequence frame which wasn't necessary.
  • Incorporated the zoom capability within the event structure.
  • When first loading the picture you may get a Mouse Up event that's basically a click through from the file dialog. There's a little check in there based on the state of the new picture.
  • Changed Zoom to percentage and added check if setting zoom to 0 that resets zoom.
It wasn't clear whether the crop should be the zoomed version or not.

One consequence of this approach: You will need to check to see if the Mouse Down occurs when the mouse is in the scroll bar. If so, you don't want to go into drawing mode. This shouldn't be too complicated, and I think an acceptable complication given the improved readability and functionality.
0 Kudos
Message 4 of 4
(2,816 Views)