I am new to Juce and am using it to prototype some software. Currently I have followed Jules’ guide for creating a first project using the DocumentWindow class. I then want to add a ToggleButton component and position it. I have the button being created and drawn correctly but can not get it to set the position. I think I am missing something about the setContentComponent call.
Here is the relevant code from within the MainAppWindow.cpp constructor.
{
setResizable (false, false); // resizability is a property of ResizableWindow, which is
// a parent class of DocumentWindow (which is our base class),
// so we have access to this setting here.
setTitleBarHeight (20); // Set the height of the titlebar on our window.
// create the main component, which is described in MainComponent.h
MainComponent* contentComponent = new MainComponent ();
setContentComponent (contentComponent);
Octave1 = new ToggleButton (T("octave1"));
setContentComponent(Octave1, true, false);
Octave1->setTopLeftPosition(20,100);
Octave1->setButtonText (String::empty);
Octave1->addButtonListener (this);
}