LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

alternative to this

Solved!
Go to solution
This should work like you want. As you add buttons you will not have to add code to handle the new buttons. You will have to change the names of the buttons if you want to.
Tim
GHSP
Message 11 of 26
(1,464 Views)

Another approach is to create an enum (and make it a typedef) which lists all the actions you want.  Connecting the enum to the selector of the case structure results in the text of the enum item appearing in the case structure.  This part of the code then is self documenting!  Use of an event structure like aeastet posted eliminates polling.  I just added an enum to your VI rather than setting up the event structure.

 

Lynn 

Message 12 of 26
(1,453 Views)

Johnsold wrote:

 

Another approach is to create an enum (and make it a typedef) which lists all the actions you want.  Connecting the enum to the selector of the case structure results in the text of the enum item appearing in the case structure.  This part of the code then is self documenting!  Use of an event structure like aeastet posted eliminates polling.  I just added an enum to your VI rather than setting up the event structure.

 

Lynn


 

You can use this method but then you still have to edit the code every time you add a button. The reason that I did the event structure the way I did was to make it maintenance free. Right click add a button and it is ready and working.

 

Tim
GHSP
0 Kudos
Message 13 of 26
(1,449 Views)

True.  For just displaying the name of the selected button this works well.

 

In the original post a specific program for each case was mentioned, so I interpreted that to indicate that some editing would be needed anyway.

 

Lynn 

0 Kudos
Message 14 of 26
(1,440 Views)

nolsqn wrote:

So my question is that is there any other way to implement this ... a rather more professional approach ?


 

We discussed all this 1.5 weeks ago here, so I don't know why you again went back to your convoluted version.
 
Each input uniquely produces one output, so why the detour with two sequential case structures?
 
0 Kudos
Message 15 of 26
(1,416 Views)

I'm guessing what you want is a "released test launcher" which launches a predefined set of Test(x).vi's.

Create your enum.  (you will be able to programatically change the property.Strings[])

Create a configuration file.  Section [Tests Released] contains keys matching the enum property.strings[] and values of file paths (to the released vi's you want to launch)

the operator then selects the test from the enum and presses run test (your code opend the config file reads the vi pathopens a referance to it and run it from an invoke node invoke.png

 

when you release a new test the operator (with admin privilages) goes to your add test button enters the test name and path to the vi and you update the config filwhen your app starts it can read the config file to learn what tests are released today that the operators can select from.

 

Easy-Professional-bullet-proof

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 16 of 26
(1,399 Views)

my question was specific to , where i am using the search 1-D array , that is there any other way of comparing the strings ......because in the case of search 1-d array it gives me the index of the element which i am then using with the case structure to perform the specific tasks ..... in my program i know that my cases will increase and it will be deficult for me to use the index numbers as the reference to my case structure ..........

 

As i mentioned for examples if i change my program see the vi ... if i increase the number of options then its gets difficult to keep track of the 2nd case structure ..........the first case structure is there to assume the data coming in , which then gets compared with the existing array constant and then once it gets compared it performs the specific task . 

Again my question is regarding the part where i am using the search 1-D array ....... how can i do that more efficently ? beacause i want to do my next step on the basis of this compare ...for example consider data is coming from the serial port and you know that the its a 1 byte of data and you also know that all of the combination of the input from the serial port and you want to make your decision , on first checking what byte of information has come and then doing the corresponding task....... so how can i implement this alternative to my basic approach ?

 

regards 

Regards
0 Kudos
Message 17 of 26
(1,374 Views)

to jeff  Bohrer

 

can you send me an example of what you are talking about . just a basic example which i can use as a refernce?

regards

Regards
0 Kudos
Message 18 of 26
(1,373 Views)

Place these on C:\

2 more vi's comming soon


"Should be" isn't "Is" -Jay
Download All
0 Kudos
Message 19 of 26
(1,342 Views)
Details next post

"Should be" isn't "Is" -Jay
Download All
0 Kudos
Message 20 of 26
(1,341 Views)