LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I Initialize a button to be enabled when the program start and if pressed then disable and gray it until a certain action is taken then comeback to the enabled state?

Hi!!!
I'm doing a program with the following buttons: Run, Abort, Repeat and Exit. When the program starts from the first time only Run and Exit button will be enabled and not disabled so the user doesn't press the Abort and Repeat button. The user has to select from a menu bar the test he wants to make then if he presses the Run button a pop up window will come up asking for the serial number and his name, and will comeback to the main program with the entered information. The user now has to press the Run button again to start the test, when the test starts the Abort button now will be enable
d and not disabled, when the test ends the Repeat button will be enabled and disabled. If the user selects new test from the menu bar the whole process will come again. I'm having problems with the menu bar because it has a time-out and when that occurs the program gets crazy. Also I'm not sure about what mechanical action I have to use for the Run. Do I need to count the times the Run button is press so the 2nd time is pressed it will be disabled. Do I need to use a sequential and where I initialize the buttons so the first time they are like I want (Inside or OUtside the while loop that ends with the Exit button) Any help wil be appreciated.
0 Kudos
Message 1 of 3
(4,050 Views)
I'm not sure about the menu bar because i've never used them..i tend to go for listboxes instead.

As for the buttons, if you want to wire the button to a local variable then the button must be a switch, otherwise a latch is ok. But remember you will probably need to reset the button at the end of a run (ie. wire a constant through the while loop to the local variable for the switch). To initialize the buttons at the start, wire constants to their locals outside the main execution while loop.

Put the disabling/enabling functions in the parts of the program the button has activated. For example, you say the 2nd time the Run button is pressed you run the 'test', enable the Abort button and want to disable the Run button - put these property nodes into th
e 'test' sequence/loop.

Sequences are useful to control when you want buttons to be modified. I use them if i cant sequence the order of execution any other way. But try and avoid using multiple frames as it can get confusing if you start hiding code.

If you are still having problems, post an example of your program in no higher than LV 6.0.2 and i will try and adapt it for you.

Kim
0 Kudos
Message 2 of 3
(4,051 Views)
If you are using LabVIEW 6.1, I would suggest using the event structure. By using such a structure, you can enable and disable buttons each time one button is pressed. This would definitely be the easiest way.

For instance, when the Run button is clicked for the second time, you can enable the abort button. Also, you could keep a numeric variable that gets updated so that you can know if the Run button has been clicked twice. Try this out and let us know how it works.
J.R. Allen
0 Kudos
Message 3 of 3
(4,049 Views)