Adding GUI Components


#1

First, my mind is officially blown by the the amount of work that has gone into this Class Library. To make it available free of charge is the kind of generosity you don't see much these days. If there was a "Donate" Button on the site, I would gladly contribute something.

I've spent a couple of days playing with it and I would like to clear something up before I get too far. To create a main window with visible controls on it, it looks like (from the notes within the classes provided) that I should create a GUI Component in IntroJucer, add my controls to it  and then use the setContentOwned method of the MainWindow instance of the DocumentWindow.

I think I set off on the wrong foot, adding buttons and sliders directly to my MainWindow Class because that's what it says to do in the book "Getting Started With JUCE".


#2

The easiest way is to use the the Introjucer.  Select GUI project with Main.CPP and a basic window.  You'll get something with a MainContentComponent created for you.   Add your stuff to that with addAndMakeVisible(...). 

The MainWindow will simply do: 

        MainWindow (String name)  : DocumentWindow (name,

                                                    Colours::lightgrey,

                                                    DocumentWindow::allButtons)

        {

            setUsingNativeTitleBar (true);

            setContentOwned (new MainContentComponent(), true);

 

            centreWithSize (getWidth(), getHeight());

            setVisible (true);

        }

Which will be fine for the start of experimentation.


#3

I've managed to create a window with some controls on it along with a menu and a shared AudioDeviceSettings that I can display and change device settings to/from my mixer. But I want to create a second window where the user will type in a couple of fields, set a default directory, etc. The only way I can see to display the window is to use the DialogWindow::LaunchOptions. Is that the preferred method? My background is in VB and C# so I am a bit lost. I've written in other languages but C++ is not my strong suit.


#4

You can also instantiate a new object of type DocumentWindow. Look at the initialise method and the MainWindow class as used in Main.cpp in a new GUI Application Introjucer project for a hint in the right direction on how to open a new window.