# Retrieving all items in a combobox as a string

**URL:** <https://forum.cabbageaudio.com/t/retrieving-all-items-in-a-combobox-as-a-string/206>\
**Category:** Cabbage Stew\
**Created:** [11 April 2016 21:09 UTC](https://forum.cabbageaudio.com/t/retrieving-all-items-in-a-combobox-as-a-string/206 "2016-04-11T21:09:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oeyvind](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/oeyvind/32/4681_2.png) [@Oeyvind](https://forum.cabbageaudio.com/u/Oeyvind)\
**Post date:** [11 April 2016 21:09 UTC](https://forum.cabbageaudio.com/t/retrieving-all-items-in-a-combobox-as-a-string/206/1 "2016-04-11T21:09:51Z")

</div>

Is there any way to retrieve the items of a combobox as a comma separated string, so I can manipulate the items during runtime?

I populate a combobox with sound files in a folder, working all ok. Then I want to add other items to this combobox, like this:  
soundfile1.wav  
soundfile2.wav  
… (all populated from the sound files in a folder), then I want to append for example:  
Sine  
Square  
Saw  
live\_sampled\_sound1  
live\_sampled\_sound2  
… etc

I managed to kludge my way around by retrieving the items one by one, building a string with comma separated items, then appending my other items to this string and using the identchannel to set the contents of the combobox. One problem is that during retrieval of the items, I trigger the actions that the combobox should trigger during normal operation, and also the whole process seems to offset the contents(items) by one, so that I select “soundfile2.wav” but the combobox sends out the string “soundfile1.wav”. I guess I can kludge my way further, but it seems I’m going about it in a very backwards fashion. Hoping there is an easier way. Suggestions welcome!

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [11 April 2016 22:30 UTC](https://forum.cabbageaudio.com/t/retrieving-all-items-in-a-combobox-as-a-string/206/2 "2016-04-11T22:30:36Z")

</div>

You may need to talk me through this:

> [@Oeyvind](#):
>
> … (all populated from the sound files in a folder), then I want to append for example:SineSquareSawlive\_sampled\_sound1live\_sampled\_sound2… etc

Are these sounds in the directory? Or do you just wish to add new items to the combobox? Or are you trying to do both, have samples from a dir, and append non directory items?

Perhaps you could use a file with the items you need in there. As of the latest Cabbage, Combo boxes can now read the contents of text file. You could write items to this file with Csound, and then update the combobox using the file() identifier with an unique identifier channel. There is also the new directory opcode in Csound that will load the names of all files of a set type in a directory to a string array. Perhaps that might also be of some help?

Also in the latest version there is a new updatefiles() method that you can call (again through an identifier channel) that will update the items in the combo box if you are reading items from a directory? Any of this sound like it might help?

---

<div class="post-metadata">

**Author:** ![Oeyvind](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/oeyvind/32/4681_2.png) [@Oeyvind](https://forum.cabbageaudio.com/u/Oeyvind)\
**Post date:** [12 April 2016 19:52 UTC](https://forum.cabbageaudio.com/t/retrieving-all-items-in-a-combobox-as-a-string/206/3 "2016-04-12T19:52:19Z")

</div>

Thanks for the tips, it looks as it the directory opcode will be very useful in building the list if items.  
I do want to have both samples from the dir and aother (non dorectory) items. Some of the extra items are dynamic in nature (created as a result of user interaction), so I need to be able to append to the list of items dynamically.  
When I tested with the directory opcode in CLI Csound, I can do what I need. But strangely I can’t get the directory opcode to work in Cabbage. I also tried to copy the csound64.dll from the canonical Csound install, in case that would allow me to use the new opcode. Still no luck. The Csound console in Cabbbage says  
error: syntax error, unexpected T\_IDENT, expecting T\_OPCODE or T\_FUNCTION or ‘,’ (token “directory”) from file C:\Program Files (x86)\Hadron\test.csd (1)  
line 19:

> > > SFilenames directory \<\<\<  
> > > Parsing failed due to invalid input!

---

<div class="post-metadata">

**Author:** ![gsenna](https://forum.cabbageaudio.com/letter_avatar_proxy/v4/letter/g/a88e4f/32.png) [@gsenna](https://forum.cabbageaudio.com/u/gsenna)\
**Post date:** [12 April 2016 19:58 UTC](https://forum.cabbageaudio.com/t/retrieving-all-items-in-a-combobox-as-a-string/206/4 "2016-04-12T19:58:27Z")

</div>

Hi Oeyvind,

Are you using Linux? Have you tried exporting LD\_LIBRARY\_PATH and OPCODE6DIR64?

For example, before running Cabbage I do:

```
export LD_LIBRARY_PATH=/opt/csound-6.06/lib:${LD_LIBRARY_PATH} && export OPCODE6DIR64=/opt/csound-6.06/lib/csound/plugins64-6.0

```

edit: Sorry, I’ve just seen the Program Files directory there! Have you tried changing the Environment settings?

---

<div class="post-metadata">

**Author:** ![Oeyvind](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/oeyvind/32/4681_2.png) [@Oeyvind](https://forum.cabbageaudio.com/u/Oeyvind)\
**Post date:** [12 April 2016 20:01 UTC](https://forum.cabbageaudio.com/t/retrieving-all-items-in-a-combobox-as-a-string/206/5 "2016-04-12T20:01:19Z")

</div>

Thanks for the quick reply, but this is currently on Windows, and I can find the other plugins. But I also thought the directlry opcodes was not a separate lib(?) Could not find a dll name where I expected to find it, so I assumed it was in csound64.dll

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [12 April 2016 20:19 UTC](https://forum.cabbageaudio.com/t/retrieving-all-items-in-a-combobox-as-a-string/206/6 "2016-04-12T20:19:46Z")

</div>

Copy the ftsamplebank.dll file, that’ll do it. I had it as a separate library, but Victor bundled it with ftsamplebank. I guess he’s trying to contain my mess!

---

<div class="post-metadata">

**Author:** ![Oeyvind](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/oeyvind/32/4681_2.png) [@Oeyvind](https://forum.cabbageaudio.com/u/Oeyvind)\
**Post date:** [12 April 2016 22:37 UTC](https://forum.cabbageaudio.com/t/retrieving-all-items-in-a-combobox-as-a-string/206/7 "2016-04-12T22:37:31Z")

</div>

Yes, that was it. Thanks
