Having trouble figuring out how to use the “Add New GUI Component” feature in Projucer.
I am able to design the GUI layout within Projucer by adding elements in the Subcomponents and Graphics tabs. This also correctly modifies the newly generated .cpp and .h files with the layout changes I make ( as seen in the code tab ).
When I click the Save to xCode button, however, it seems to copy the generic automatically created versions of the .cpp and .h files into xCode and not the code seen in Projucer ? The project builds and runs, but just shows the generic “Hello World” GUI template … and not the custom GUI I designed in Projucer?
Thanks … I am not sure how to do that after creating a new project using the Audio Plug-In template …
It creates a PluginEditor class … but I am unsure on how to make the new class created after adding a new GUI Component tie into that … may just have to dig around a bit more. I am somewhat familiar with xCode and Objective-C , but new to JUCE and C++ .
Guess my hope was that after hitting ‘adding new GUI component’ in the Projucer… it would make those parent child class connections as part of that process ( laziness on my part admittedly )
I don’t know much about the plugin side of things, but for regular applications, a Main.cpp, and MainContent.cpp/h are created. When you create a custom gui via the ProJucer, it’ll make a 3rd cpp/h file. CustomGUI.cpp, CustomGUI.h
In your MainContent header file, you’ll need to import this 3rd header #include CustomGUI.h
and add a private class member that is an instance of this custom gui class
then in your MainContent constructor, you’ll add your customGUI as a child component. addAndMakeVisible( customGUI );
In your MainContent::resized() method, you’ll make the customGUI fill up the space: customGUI.setBounds( getLocalBounds() );
If all of that was confusing, then you probably need to learn some basic C++ before you try to use JUCE, as JUCE assumes you know how to do stuff in C++.
Thanks ! Got it wired up right now . Added the CustomGui class as a child to PluginEditor.cpp/h and it worked. Though I had to copy and paste code from Projucer into xCode – when I hit save to xCode in Projucer it doesn’t seem to update the files in xCode? . I am probably doing something incorrectly.
There are two kinds of saves in the Projucer. If you’re looking at a source file it will save the changes in that file, if you are elsewhere then saving will regenerate the Xcode project. Since the Xcode project just references source files (rather than taking a copy) you need to make sure to save the source file in the Projucer to see the changes in Xcode.