Sending slider events from popup window?


#1

Hi all!

I’m relatively new to JUCE (and event-driven OOP GUI dev). That said, I’ve begun development of a patch-editor with pop-up parameter windows. Depicted in the screenshot below are the main window (behind), and the “voiceGUI” popup window (in front). voiceGUI is a documentWindow instantiation with contentOwned set to a component created with Projucer.

I am struggling to find the correct means of forwarding slider data (from sliderValueChanged callback) to my main class, which owns the MIDI output. Perhaps sliderValueChanged should generate asynchronous events? Or is it better to somehow add a listener to an array of slider data? Any help is appreciated.


#2

Assuming the main window owns the child window and midi data can’t you just register the main window as a slider listener to your sliders in the parameter window?


#3

That sounds very promising. Perhaps there is some way for the main window to pass itself into the param window constructor, so that the it can be registered as a listener to the param window’s (private) sliders?


#4

The solution, phenomenally, is an inclusion of the parent class (main window) by the child (voiceGUI). This seemingly circular scheme was proposed by none other than Jules himself in a 2-year-old thread. OOP, it seems, has no issue at all with bidirectional inclusion methods.

Having done this, MIDI OUT functions can be called directly from the slider callback.