# cabbageGetValue with string-values?

**URL:** <https://forum.cabbageaudio.com/t/cabbagegetvalue-with-string-values/4964>\
**Category:** Cabbage 3\
**Created:** [5 January 2026 20:09 UTC](https://forum.cabbageaudio.com/t/cabbagegetvalue-with-string-values/4964 "2026-01-05T20:09:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hdale94](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/hdale94/32/6371_2.png) [@hdale94](https://forum.cabbageaudio.com/u/hdale94)\
**Post date:** [5 January 2026 20:09 UTC](https://forum.cabbageaudio.com/t/cabbagegetvalue-with-string-values/4964/1 "2026-01-05T20:09:41Z")

</div>

I’m working with the optionButton, and seem to be struggling to extract the current string-value of the channel with cabbageGetValue. Is this possible? Found nothing about it in the docs:

> **[CabbageGetValue](https://rorywalsh.github.io/cabbage3docs/docs/cabbage_opcodes/cabbageGetValue)**

> **[OptionButton | Cabbage](https://rorywalsh.github.io/cabbage3docs/docs/cabbage_widgets/optionButton/)**
>
> optionButton creates a button which users can use to toggle through a range of items. Pressing the button will send the index of that item to Csound on a channel named by the channel string.

---

<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:** [6 January 2026 19:04 UTC](https://forum.cabbageaudio.com/t/cabbagegetvalue-with-string-values/4964/2 "2026-01-06T19:04:32Z")

</div>

Currently the only workaround is to get th index and then looks up the values yourself. For example:

```cpp
<Cabbage>
[
    { "type": "form", "caption": "Untitled", "size": {"height": 300, "width": 600}, "pluginId": "def1" },
    {
        "type" : "optionButton",
        "bounds" : {"left": 45, "top": 47},
        "channels": [{"id": "optionButton2", "range": {}}]
    }
]
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>
nchnls = 2
0dbfs = 1

instr 1
  items:S = [“Item1”, “Item2”, “Item3”]
  optionButton:k, optionButtonTrig:k = cabbageGetValue(“optionButton2”)
  printf(“Selected item: %s”, optionButtonTrig, items[optionButton])
endin

</CsInstruments>
<CsScore>
i1 0 z
</CsScore>
</CsoundSynthesizer>

```

I am going to add an array version of cabbageGet to get the items array. That will make things a little simpler. I can also add a ``currentText`` property. I can do that now and trigger a new build.

---

<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:** [6 January 2026 19:47 UTC](https://forum.cabbageaudio.com/t/cabbagegetvalue-with-string-values/4964/3 "2026-01-06T19:47:18Z")

</div>

I just triggered a new build wher we can now do this:

```cpp
instr 1
    items:S[] = cabbageGet("optionButton2", "items")
    optionButton:k, optionButtonTrig:k = cabbageGetValue("optionButton2")
    printf("Selected item: %s", optionButtonTrig, items[optionButton])
endin 

```

This update features quite a bit of work done in the dev branch over the last month. Let me know if you have any problems.
