Showing results for 
Search instead for 
Did you mean: 

Case structure with separate buttons to trigger individual cases?

Go to solution

I'm trying to use a case structure where each case is triggered by a button press.  This is simple using a numeric control, however I do NOT want the up down arrow to select the desired case.  I need individual buttons displayed on the front panel (one button for each case).  In the code pasted below I want to use the Case 0-4 buttons instead of the numeric control.  Is there a way to modify the numeric control to be individual buttons instead of the arrow up/down control?


case structure.png

0 Kudos
Message 1 of 13

If you are working with LV 2013, you should use the "Create Project" Assistant. You will find a "Simple State Machine" there.

Please check out if you understand the code thhis assistant provides. If you don't understand it, your LV skills have to be improved. You can do this by following online tutorials as well as attending LV classes.



CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 13

Yes, use a radiobutton control.  Attach your actual VI instead of a picture if you want more specific help.

0 Kudos
Message 3 of 13

Assuming the buttons are latch action, you can build them into an array and serch for the position of the true element.


If the buttons are switch action and you want a case for all possible button combinations, again built them into a boolean array and then use boolean array to number.

0 Kudos
Message 4 of 13

Thanks,  I think the radio buttons are exactly what I need.  I had looked at the radio buttons earlier but but seeng them only in the Boolean menu made me think they could only be a single boolen true/false.  I see now you can copy/paste more buttons. 


Sorry if this question was too simple.  I did spend a lot of time looking for a solution before posting believe it or not.  

0 Kudos
Message 5 of 13

Here is a quick example using radio buttons.



0 Kudos
Message 6 of 13

You could use an Event structure.

You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 7 of 13

The event sructure seems to match better what I am working on partly because the physical layout of the buttons seems easier to control.  Basically i'm creating a buttons in labview for each button on some test equipment, creating a front panel that matches the real equipment.   Thanks for the help.

0 Kudos
Message 8 of 13

An event structure has nothing to do with the physical layout of the buttons and seems to address a question quite different from your original problem description. Please tell us a little more about your application.

0 Kudos
Message 9 of 13

More info:   I have an Advantest R3463 spectrum analyzer (although this idea will apply to many GPIB enabled instruments) and I am trying to use Labview to control the instrument via GPIB commands.  On the labview front panel I want to place a bunch of buttons where each button sends a specific GPIB command.  E.g.:  clicking a button on the front panel labeled  "View Trace" will send the GPIB command "AV" once and only once per click.  Clicking the button "Max Hold" will send the GPIB command "AM", etc.  After the button is clicked and the command sent, it needs to reset to the unpressed position.  The event structure seems to work fine.  For the purpose I described, is there any advantage to either the case structure or event structure?


code attached.

0 Kudos
Message 10 of 13