11-23-2010 09:56 PM
Hi
If I have a list of strings in a combo box and the user selects one from the drop-down, how do I get the index? I could search the array for the string selected but it seems like double work to create a list and then go back and search it.
Thanks
Brendon
Solved! Go to Solution.
11-23-2010 11:54 PM - edited 11-23-2010 11:54 PM
Hi,
What exactly you want to achieve by getting the index of the selected Item?.. If you want only the index means you can go for the Enum controls that will give you the index as output and you can also get the items by using the property node...
11-24-2010 02:36 AM
It's easier to change to Ring control or Enum which gives the index as default, a Combo box gives a string which must be converted. But if you really like the graphic design and want to use the ComboBox you can deselect "use strings as values" and enter the index as numbers, then do a String to Decimal conversion.
/Y
11-24-2010 05:37 PM
Thanks for your responses.
The plan was to be able to remember the last position that an entry was selected from and automatically scroll to that position the next time the drop down was selected. I have a list of about 200 items but relevent items are usually nearby each other in the list.
I just incremented an int, changed it to string and wrote it into 'StringandValues[]' as a value, much as one suggestion... suggested.
Thanks again
11-24-2010 07:08 PM
I just read my response - I meant I was dealing with two combo boxes...
10-24-2014 02:34 AM
Hi
May I ask how to deselect "use strings as values" and enter the index numbers for combobox?
Thank you
10-24-2014 06:11 AM
10-24-2014 06:54 AM
tiho wrote:
May I ask how to deselect "use strings as values" and enter the index numbers for combobox?
That sounds like a Ring to me. A ring shows strings, but its data type is actually a number.
02-12-2017 01:02 PM
This will gives you index number of selected element
02-12-2017 03:56 PM
Nothing like replying to a 2.5 year old thread with a bad solution. Exceptable solutions here, in order, would be 1) use a text ring or 2) use Search 1D Array.