07-14-2017 03:20 PM
Hello!
So I am making a VI that will be used in testing something at multiple voltage values. Essentially I would like to have a control on the front panel that will allow the user to enter multiple voltage values that they wish to run the test with, that way they can run the test once instead of having to change the value and run the test multiple times. I'm not certain what control on the front panel would work best with having a varying number of inputs to it (between 1 and 6 different voltage values). I tried just a simple array but the issue with that is if you want to have 5 different values the first time and then only 3 the second time, there are still going to be 5 elements in the array from when you ran it the first time as opposed to 3. I really hope this is making sense, but I would really like something to where you can select the number of values you want to use and then simply type in each value or something along those lines.
Maybe I am just brain dead today, but I can't think of a way to do this so any help is appreciated!
Solved! Go to Solution.
07-14-2017 03:44 PM
Do you have an expected maximum number of inputs?
You could create a series of enums or rings. Let one of the values in that list be None.
You could certainly create an array and have an input for number of inputs. Use an event structure so that when ever there is a value change for the number of inputs, it Deletes the extra elements from the array or adds more default values to it. You can change the number of elements shown and take away the index and scrollbar so there is no way a user could add more elements without actually using the #ofInputs control.
07-14-2017 03:48 PM
Yes the max number of inputs would be 6.
Ah I didn't think of programmatically deleting the extra elements in the array. I think I will try that out! Thanks!
07-14-2017 04:21 PM
So maybe I am not doing this right, but I am deleting elements in the array by simply writing the correct array size to the local variable of that array. This leaves the correct number of boxes in the array un-grayed for the user to type in, but if they want, they can still input numbers into the gray boxes, thus adding an extra element. I would like to make this more dummy proof by making it so they can't add more values than what they specify. Is this possible?
07-14-2017 04:52 PM
Easy Way
Remove the array index display or any scrollbars, make the array a size of six, thus no more than six elements are visible or accessible at any one time.
mcduff
07-14-2017 04:59 PM
How did you make an array like that?
07-14-2017 05:05 PM - edited 07-14-2017 05:12 PM
I made a cluster then "dropped" it into an array control.
Right-click the control and chose the visible items that you would like to hide, like scrollbar, index display, etc.
mcduff
EDIT:
You can also make a six element cluster, this way your controls can have different names.
07-14-2017 05:08 PM
Oh I see! Thank you!!
07-14-2017 08:05 PM - edited 07-14-2017 08:06 PM
@ebohannon wrote:
So maybe I am not doing this right, but I am deleting elements in the array by simply writing the correct array size to the local variable of that array. This leaves the correct number of boxes in the array un-grayed for the user to type in, but if they want, they can still input numbers into the gray boxes, thus adding an extra element. I would like to make this more dummy proof by making it so they can't add more values than what they specify. Is this possible?
Did you do the other part that I said where when you set the array to have a certain number of elements, you use the property node to show that number of elements? Without a scrollbar and index, then there is no way
for a user to get to the unused elements to start typing stuff in and add more elements.
07-17-2017 10:28 AM
Well that's where I went wrong, I did not use that property node. Thank you for clarifying! Appreciate the help!