08-19-2013 10:38 AM
For an experiment control application I would like to use an array for experimenter input. The experimenter will type in as many values as they choose, usually less than ten, and the LabView program will use each value based on the size of the array. All is well on the initial setup and any further setup that needs more values, the array will grow nicely. Should the next setup require fewer values the array continues to require values for the largest array entered until the array is initialized on start up. A reset button will obviously reset the array but requires an additional control, user training, and frustration when forgotten and values entered before resetting. Is there some way, for example deleting the excess values, to reduce the size of the array?
Also, can the tab or enter key be used to move between values in the array?
Solved! Go to Solution.
08-19-2013 11:03 AM
You may be able to program an event structure that acts on the Key Down? event and if the key is a tab, and the array has focus, then select the next item in the array.
As for the reducing the size of the array question. How do you want the user to be able to remove the "extra" elements in an array from a previous run? How do you want the user to tell the program the difference between a newly entered value, a previously entered value that you want to keep, and a previously entered value that you want to remove. That is more of a user interface question than a LabVIEW question. How would you want the user to do this if you were in some other program?
Once you figure this out, then we could figure out how to make it happen. Do you want the user to "blank" out the unused elements? Than LabVIEW could find the blank element and trim the array back. Perhaps instead of using an array, you might be better off using a table control.
08-19-2013 11:49 AM
My first thought is the delete key. Pressing delete would reset the element back to the undefined state (not sure I know what that state is but the grayed out state of an initialized array) and truncate the array to that length.
Thank you for your response to this question and to my previous one.
08-19-2013 11:57 AM - edited 08-19-2013 11:58 AM
As RavensFan mentioned, how you remove elements depends highly on your desired user interface.
You could easily make a button for them to press which would delete the currently selected entry in the array.
OR, you could replace the array with a listbox, allowing the user to select ALL entries they wish to delete before pressing a button.
Replacing undesired entries with a zero, and then deleting all such entries.
You could do the button option, but tie the button to a key command and hide it, this way a user could delete an entry by pressing CTRL + SHIFT + K (for example).... The list goes on and on.
The delete key is used to delete a number based on cursor positon (I highly recommend you choose an option that is not commonly used for something else).
08-19-2013 12:37 PM
Try this. I don't have time to clean it up at the moment.
08-19-2013 01:03 PM
Thank you this looks like a solution. Parts of LabView I have never used. Will take me a while to understand but the basic idea is clear.
Thanks to everyone who responded.