Can I put a TextButton in the APVTS, and access its toggle state?

I’ve got an APVTS structure with a number of SliderAttachment entries for my knobs.
I want to add a TextButton. I’ve set this clicking toggle state to true.

How do I add this TextButton to my APVTS, and can I use getRawParameterValue to find its toggle state?

Here’s what I have so far:


juce::TextButton mybutton_button;
juce::AudioProcessorValueTreeState::ButtonAttachment mybutton_buttonAttachment;

In PluginEditor.cpp

	mybutton_button.setButtonText("my button text");

PluginEditor Constructor:
mybutton_buttonAttachment(audioProcessor.apvts, "mybutton", mybutton_button) {

In PluginProcessor.cpp
mybutton_value = apvts.getRawParameterValue("mybutton")->load();

for my sliders, I am adding them to the layout with createParameterLayout(). I think I can’t add the mybutton attachment here… … or can I :thinking:

I may be mistaken, but you’d add mybutton_button to the layout, not the attachment, but I believe if you could add slider attachement, you could do the same with buttons.

In the end I was able to put it in the parameterLayout.
layout.add(std::make_unique<juce::AudioParameterBool>("mybutton", "my button text", false));
Seems to work.