Access tabbed component children sliders


#1

hey,
sorry for the noob question.
I’m using Projucer to create all my gui’s.
so this is my setting:
MainComponent->GUI->tabbedComponent->anotherGuiComponentWithSliders.
so how can I set or get the slider values in “anotherGuiComponentWithSliders” from “GUI”. or even better MainComponent?
since I’m beginner a little tiny example would be great!

thanks & cheers
K


#2

if the slider in your anotherGuiComponentWithSliders class is private, add a getter:

struct anotherGuiComponentWithSliders : public Component
{
    Slider& getSlider() { return slider; }
private:
    Slider slider;
};

then you can call the public member functions of the returned slider.

auto sliderValue = MainComponent->GUI->tabbedComponent->anotherGuiComponentWithSliders.getSider().getValue();

#3

thanks!!