06-21-2010 04:43 PM
Hello,
In the following VI I am trying to get the "CAM" tab to be disabled and greyed out while the "ACQ Start" boolean is True and then become enabled again once the "ACQ Start" boolean becomes false. I also want the "ACQ" tab to do the same while the "Test" boolean is used. Both boolean buttons will be controlling functions that are using the same camera interface, only not at the same time, but I want to make sure I don't go from the active "ACQ" tab which is in the process of acquiring images to the "CAM" tab to test my camera settings while the camera interface is already being used by the "ACQ" tab functions. The VI I attached is a scaled down version of the main VI I'm developing, but hopefuly it has enough to give someone an idea of what I'm trying to accomplish. I've searched around and came up with the event structure that's in the VI. What I have disables the "CAM" tab when I press the "ACQ Start" button, but it doesn't become enabled once again after I stop the acquisition.
Any ideas?
Thanks!
Solved! Go to Solution.
06-21-2010 05:15 PM
It will become enabled again if you set the front panel controls for the "Page index" and the "Page Enabled State" correctly before you press those buttons. Why do these two controls even exist in the first place? Your code should handle accessing the correct tab and then setting the enabled/disabled state based on the value of the Boolean.
Other comments:
You may want to consider looking at a more robust programming architecture such as the Producer-Consumer architecture.
06-22-2010 12:10 PM
Thanks smercurio_fc for the help.
The reason I set up the tab control like I did is because it is the only way I have found to get the outer while loop to run and recognize a tab selection change while an inner while loop is running. I'm using the "ACQ Start" boolean to start and stop image acquisition so it has to be "active" using the while loop so that I can start and stop the acquisition functions inside the case loop at any time.
I did remove the False constant associated with the boolean controls. I don't know where I picked that up?
I am by no means an expert at this. I have been learning Labview on my own over the past three months, so I'm sure my vi's are not the most efficient. I end up using whatever I can find that seems to accomplish what it is I'm trying to do. I am completely open to suggestions like you listed previously.
For now, I am mainly interested in disabling the "CAM" tab while the "ACQ Start" boolean is giving a true statement. Anything extra I can get along with it is bonus material.
06-22-2010 01:29 PM
Having all those loops like that unfortunately makes this confusing and actually works against you. What you need to do is to separate the event handling from the execution. You can do this by simply having just 2 loops. One loop handles the events, and the other just performs the process. See attached mod as a starting point. Note that I decreased the loop time for the "process" loop for demonstration.
06-22-2010 02:28 PM
Thanks! It does exaclty what I was looking for. I also took your advice and removed some of the while loops that weren't needed.
Thanks again for the help!