LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

disabling tabs while certain items are running

Solved!
Go to solution

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!

0 Kudos
Message 1 of 5
(2,915 Views)

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:

  • Your architecture is dubious. Is the loop in case 0 supposed to be running until some condition? Right now it only runs once. 
  • You do not need to perform all those gymnastics in getting the tab that's active. Just wire the tab terminal directly to the case structure selector. The datatype of the tab is essentially an enum, so the case items are automatically updated.
  • What is the purpose of OR'ing a Boolean control with a False constant? Is that False constant a placeholder for something else? Otherwise, it's pointless. 
  • The Wait function in the outer loop doesn't do you any good. The event structure will prevent the outer loop from going to the next iteration until an event is generated that the event structure is set up to handle.

You may want to consider looking at a more robust programming architecture such as the Producer-Consumer architecture.

0 Kudos
Message 2 of 5
(2,903 Views)

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.

0 Kudos
Message 3 of 5
(2,877 Views)
Solution
Accepted by topic author dirtpics

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.

Message 4 of 5
(2,864 Views)

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!

0 Kudos
Message 5 of 5
(2,855 Views)