02-04-2017 02:35 PM
Hi Labview masters,
I would like to create a VI program where I want a couple of string rows to be the choices for a user to select from.
What method do I use for this? A constant string will be added to the choice and then a conditional string which will be unique for each choice. So basically a list of strings, one constant string to be added to what ever choice and then a conditional string.
I assume that I could use cases for this?
Solved! Go to Solution.
02-04-2017 03:37 PM
What you're describing is a listbox. Hit ctrl+space on the front panel and type that into quick drop.
Ctrl+H will give you context help to understand a bit more about the listbox
02-04-2017 05:46 PM
I listbox looks like a table with the ability to select an item.
A combobox is a drop down list that you can select from.
Either of these options will likely solve your problem. It is just a matter of what kind of interface you actually want.
02-05-2017 05:48 AM
Are you looking for something like combo box.
if so it can be traced by right clicking on the front panel control pallet , string & path and then combobox
.
02-05-2017 07:43 AM
Thank you all for your replies,
Yes I switched to combobox, liked it more.
02-05-2017 08:19 AM - edited 02-05-2017 08:39 AM
I was hoping to find some examples in the labview software for utilization of Combobox but find none, listbox has 2 examples.
I still do not know how to wire and then program the strings in the combo box though.
For instance if i have a combobox with 3 strings in it, iow 3 possible choices and then there should be a result
if A (selective in the combobox) is slected then a string constant1 + string constant 2 (or string from an array of three strings) to be displayed in a concatenated string as result/comment
and so on
Cheers
02-06-2017 01:48 AM - edited 02-06-2017 01:49 AM
Hi Chrisus,
if A (selective in the combobox) is slected then a…
when you wanto to start an action based on an input you most often should use a case structure!
It's the LabVIEW equivalent of an IF-THEN-ELSE-ENDIF…
When your "strings" look like "A, B, C" then you might use enums or even a Radio button: they can be wired to case structures and you will have their "strings" as case descriptions!
02-06-2017 06:11 AM
GerdW wrote:
When your "strings" look like "A, B, C" then you might use enums or even a Radio button: they can be wired to case structures and you will have their "strings" as case descriptions!
A ComboBox has a string data type. So you will have similar results. Here is the beauty of the combobox: you can change the strings at runtime. And Enum is great for when the options are constant. But for the changing on the fly, I go with the combobox.
02-07-2017 02:45 PM
Okey, as the rookie I am I have to consult your expertise again guys.
I am tryign to use a combobox as the user input for the case structure. I still get the error of some cases missing selector type?
Here is my vi,
02-07-2017 03:01 PM
Create a case that is called Default. It can put out nothing or an error message or something.
Right now, you don't have any code that can execute if the number happens to be anything but 0, 1, 2, or 3.
But you have other problems. The string only updates once you stop your VI because the terminal is outside the loop.
Also, the combo box gives a string, but you are trying to convert that to a number. Since it is a word and not a string of numbers, it gets converted to a default of 0.