As a beginner in Juce framework, I many times tried to understand the GUI environment. This means its general design philosophy and implementation approach.
Unfortunately, I did not find an easy and comprehensible document to guide my effort.
So, in the following plain description, I am trying to describe the method I used to implement a Juce GUI environment, based on what I understood from the existing documentation.
Please note that the real meaning of this post is to get the useful opinion of the experienced members of the forum in order to be better and to help any other Juce beginner.
Consider we have to implement a GUI environment, consisting of:
- One main content component, shown in the Main Window
- Two distinct areas within this component, named as ControlPanel and OperationPanel.
My approach is based on the following schema:
- We create a corresponding class for each distinct area, with their .cpp and .h files
- We design the appropriate GUI with the Introjucer for each area, starting at 0,0 position.
- In the MainContentComponent, we define a member variable for each class.
- In the MainContentComponent’s constructor, we also include the constructors of the above two classes.
- In each class constructor, we set the size of the entire subcomponent to be equal to the bottom-right coordinates of the last bottom-right GUI object.
- After that, in the MainContentComponent’s constructor we set the size of the entire MainContentComponent, accordingly to the above steps.
- And finally, we can set the size of the mainWindow respectively.
Using the same logic, we can to create many other MainContentComponets.
Under this approach:
- We can design easily and maintain independently, each GUI's part for this specific app.
- We can reuse each separate part into any other app, without having to do major changes.
However, all the above is an approach of a beginner.
Now, my questions are:
- Probably there are many other ways to do this. But, is this an appropriate approach to design GUI with Juce environment?
- If not, why?
Thanks in advance for every comment and idea