# Idea: string name support for radiogroup()

**URL:** <https://forum.cabbageaudio.com/t/idea-string-name-support-for-radiogroup/1046>\
**Category:** Cabbage Stew\
**Created:** [15 May 2018 00:44 UTC](https://forum.cabbageaudio.com/t/idea-string-name-support-for-radiogroup/1046 "2018-05-15T00:44:52Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![t\_grey](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/t_grey/32/1234_2.png) [@t\_grey](https://forum.cabbageaudio.com/u/t_grey)\
**Post date:** [15 May 2018 00:44 UTC](https://forum.cabbageaudio.com/t/idea-string-name-support-for-radiogroup/1046/1 "2018-05-15T00:44:52Z")

</div>

The problem I have is using a radiogroup within the imported widget, it can’t be used more than once per instrument because all instances will refer to the same group and act as one.

If radiogroups() supported string names it would be far easier to use them within imported widgets safely, avoiding conflict with any other radiogroups() that may exist.

I would also suggest that radiogroups() within an imported widget’s cabbage section should get parsed to include the channel prefix, similar to channel() and identchannel(). Hopefully this would still be compatible with numeric groups, for example… radiogroup(1) could become radiogroup(“ChannelName1”)

---

<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:** [16 May 2018 11:29 UTC](https://forum.cabbageaudio.com/t/idea-string-name-support-for-radiogroup/1046/2 "2018-05-16T11:29:47Z")

</div>

I see your point…I’l take a look

---

<div class="post-metadata">

**Author:** ![t\_grey](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/t_grey/32/1234_2.png) [@t\_grey](https://forum.cabbageaudio.com/u/t_grey)\
**Post date:** [2 April 2019 10:23 UTC](https://forum.cabbageaudio.com/t/idea-string-name-support-for-radiogroup/1046/3 "2019-04-02T10:23:53Z")

</div>

Bringing this back up because I think it’s important for imported widget groups.

I have at least one imported widget group that I would like to import multiple instances of in a single instrument, but the widget group makes use of radiogroups. This is currently (afaik) impossible.

---

<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:** [2 April 2019 10:32 UTC](https://forum.cabbageaudio.com/t/idea-string-name-support-for-radiogroup/1046/4 "2019-04-02T10:32:52Z")

</div>

I will look into this now. I don’t think it should be that tricky..

[edit] Might not be as simple as I thought s the JUCE `Button::SetRadioGroupId()` method takes an integer value. Trying to create a integer representation of a string won’t work because of the size limit on an int. I might have to use a look up table. It’ll be a bit more work. Leave it with me 😉

---

<div class="post-metadata">

**Author:** ![t\_grey](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/t_grey/32/1234_2.png) [@t\_grey](https://forum.cabbageaudio.com/u/t_grey)\
**Post date:** [2 April 2019 10:55 UTC](https://forum.cabbageaudio.com/t/idea-string-name-support-for-radiogroup/1046/5 "2019-04-02T10:55:53Z")

</div>

Awesome, thanks! This was one that I had run into before, and just bumped into again… figured I’d bring it up in case it was forgotten on the back burner.

---

<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:** [2 April 2019 15:17 UTC](https://forum.cabbageaudio.com/t/idea-string-name-support-for-radiogroup/1046/6 "2019-04-02T15:17:02Z")

</div>

Think I have that sorted now. Just pushed a commit through. Watch out for the next successful build in Azure DevOps…

---

<div class="post-metadata">

**Author:** ![t\_grey](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/t_grey/32/1234_2.png) [@t\_grey](https://forum.cabbageaudio.com/u/t_grey)\
**Post date:** [2 April 2019 22:04 UTC](https://forum.cabbageaudio.com/t/idea-string-name-support-for-radiogroup/1046/7 "2019-04-02T22:04:46Z")

</div>

Hrm, it doesn’t look like this is working. If I put a string in as the radiogroup(), the radiogroup declaration disappears entirely from the line when the widgets are imported. It still works appropriately when the ID is numerical.

This is tested with today’s “.4” build that fixes the button outline color in imported widgets.

---

<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:** [3 April 2019 08:57 UTC](https://forum.cabbageaudio.com/t/idea-string-name-support-for-radiogroup/1046/8 "2019-04-03T08:57:16Z")

</div>

Seems to be working fine here. Try the attached.

[CustomPlantImport.csd](https://forum.cabbageaudio.com/uploads/default/original/2X/d/d2abe86def1a187867541898263f37dd5810ebce.csd) (651 Bytes)  
[plant.plant](https://forum.cabbageaudio.com/uploads/default/original/2X/8/863588310343cec45195a37b895ce8fd2d6aa661.plant) (2.0 KB)

---

<div class="post-metadata">

**Author:** ![t\_grey](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/t_grey/32/1234_2.png) [@t\_grey](https://forum.cabbageaudio.com/u/t_grey)\
**Post date:** [3 April 2019 09:52 UTC](https://forum.cabbageaudio.com/t/idea-string-name-support-for-radiogroup/1046/9 "2019-04-03T09:52:02Z")

</div>

Confirmed, your example worked… and I was almost stumped, but then I change the radiogroup name to “ABCD” it no longer works.

I’m not sure, but I think it may have to do with capital case? On that note, would/should any other non-alphanum chars like -\_+=/ etc be acceptable? I know I often use - and \_ as separators in channel and variable names.

---

<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:** [3 April 2019 12:08 UTC](https://forum.cabbageaudio.com/t/idea-string-name-support-for-radiogroup/1046/10 "2019-04-03T12:08:56Z")

</div>

Good spot. I’ll take a look. Pretty busy today but will try to get around to it.

---

<div class="post-metadata">

**Author:** ![t\_grey](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/t_grey/32/1234_2.png) [@t\_grey](https://forum.cabbageaudio.com/u/t_grey)\
**Post date:** [3 April 2019 12:17 UTC](https://forum.cabbageaudio.com/t/idea-string-name-support-for-radiogroup/1046/11 "2019-04-03T12:17:44Z")

</div>

Great! No worries if it takes you a little bit… I’m just glad I’m not going crazy. I was doubting myself for a minute, I had stripped and tested a pretty sparse example before saying it didn’t work 🕵️‍♂️

---

<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:** [3 April 2019 16:14 UTC](https://forum.cabbageaudio.com/t/idea-string-name-support-for-radiogroup/1046/12 "2019-04-03T16:14:36Z")

</div>

should be fixed now 😉

---

<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:** [5 March 2020 10:34 UTC](https://forum.cabbageaudio.com/t/idea-string-name-support-for-radiogroup/1046/13 "2020-03-05T10:34:35Z")

</div>

Hi @t_grey. I think this is Ok now. Can you try [this](https://dev.azure.com/rorywalsh/cabbage/_build/results?buildId=602&view=artifacts&type=publishedArtifacts) one.  
 ![2020-03-05 10.32.46](https://forum.cabbageaudio.com/uploads/default/original/2X/6/650d3392a4f1d040378cbb680777afa6921a8407.gif)

---

<div class="post-metadata">

**Author:** ![t\_grey](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/t_grey/32/1234_2.png) [@t\_grey](https://forum.cabbageaudio.com/u/t_grey)\
**Post date:** [5 March 2020 13:24 UTC](https://forum.cabbageaudio.com/t/idea-string-name-support-for-radiogroup/1046/14 "2020-03-05T13:24:04Z")

</div>

_This_ is the necro-bump I’ve been looking for 🤣

I didn’t get to entirely run it through the ringer yet, but so far this looks great. The version number reported (from Lite) still matches my build from a year ago? I checked md5s of the app, it’s definitely new 😉

It also looked like popuptext for these buttons didn’t show… but to be fair, it’s been so long since I’d paid these buttons much attention that I’m not entirely sure they were displaying popuptext before I updated either.

---

<div class="post-metadata">

**Author:** ![Bryan\_T](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/bryan_t/32/5680_2.png) [@Bryan\_T](https://forum.cabbageaudio.com/u/Bryan_T)\
**Post date:** [2 July 2024 00:03 UTC](https://forum.cabbageaudio.com/t/idea-string-name-support-for-radiogroup/1046/15 "2024-07-02T00:03:38Z")

</div>

Is this still the preferred way to do radio buttons? The example has some strange behavior. The “2” button doesn’t write to the Csound terminal.

Is there a way to make the radio buttons exclusive? Like, if I press 1 while 2 is pressed, then 2 should turn off.

Thanks!

---

<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:** [2 July 2024 08:16 UTC](https://forum.cabbageaudio.com/t/idea-string-name-support-for-radiogroup/1046/16 "2024-07-02T08:16:56Z")

</div>

No, the preferred way is to simply add a radioGroup(int) to each button you want to form part of the radio group. They will automatically combine to create an exclusive grouping of button. The issues discussed here were to do with special imports.
