From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What am I doing wrong?

Solved!
Go to solution

I want to disable the button when the user presses it, and if a previous button was on, then turn it off and enable it.

 

I can't quite see where am I going wrong.

 

Thanks 

 

Kas

Download All
0 Kudos
Message 1 of 5
(2,605 Views)

Well, for one thing, having an event structure inside one of the cases of a state machine is a bad idea. Methinks you may want to look at the producer-consumer architecture.

 

As for the actual code: Can't guess - the subVI that does the work is not included. 

Message 2 of 5
(2,598 Views)

Uh, sorry, forgot to include the subvi.

 

 

P.S. Why would an event inside a case structure be bad? I would've thought this is common for state machine programming. 

 

Thanks 

 

Kas

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

The way you have it right now your event structure locks up your state machine. I don't know where you're going with the program, but one could argue that your state machine is not necessary.

 

As for other issues:

  • The buttons in the clusters are not ordered correctly.  At least with respect to the numbers you've assigned via the button text. Right-click on the cluster and select "Reorder controls in cluster..."
  • The fundamental problem you have is that the "new" cluster you are receiving is not the final value. You are actually receiving a "transitional" value in which you will have two buttons as True. Just put a probe on "new" and you will see. The subVI you have is assuming only one button is true for either the "old" or "new". 
  • You are not initializing the cluster so that you enable all of the buttons and set them to False.

Ultimately, it seems to me that you're just trying to reinvent radio buttons. LabVIEW already has radio buttons and you can customize the radio button control to use square buttons instead of the circular buttons. You can even add the lines that you currently have. This seems a heck of a lot easier than what you are trying to do.
Message 4 of 5
(2,575 Views)

hah now there's a thought. I never thought I can modify radio buttons in that manner.

 

Thanks 

 

P.S. Congradulations on becoming a Night. Well deserved. 

 

Thanks 

 

Kas

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