Hi,
A long time ago I posted a question which I still haven’t had solved here is a follow-up. When I resize my window the openGl canvas does not resize accordingly.
I get this error when at run-time:
I believe I do the resizing similarly to how it’s done in the juceDemo.exe
[code]class VstAnalyzerWindow : public DocumentWindow
{
OpenGlCanvas* openGlCanvas1;
OpenGlCanvas* openGlCanvas2;
public:
//==============================================================================
VstAnalyzerWindow()
: DocumentWindow (T(“VstAnalyzer”),
Colours::lightgrey,
DocumentWindow::allButtons,
true)
{
setContentComponent (new VstAnalyzer());
setVisible (true);
centreWithSize (800, 512);
this->setResizable(true,true);
this->setResizeLimits(512,512,2048,2048);
// adding buttons
TextButton* buttons[NUMBER_OF_BUTTONS];
for(int i=0;i<NUMBER_OF_BUTTONS;i++)
{
buttons[i] = new TextButton(T("Button"+String(i)));
addAndMakeVisible(buttons[i]);
buttons[i]->setBounds(10,30*i+50,50,20);
}
buttons[NUMBER_OF_BUTTONS-1]->setButtonText(T("EXIT!"));
buttons[NUMBER_OF_BUTTONS-1]->changeWidthToFitText();
// adding Opengl canvas
openGlCanvas1 = new OpenGlCanvas();
openGlCanvas2 = new OpenGlCanvas();
addAndMakeVisible(openGlCanvas1);
//addAndMakeVisible(openGlCanvas2);
openGlCanvas1->setBounds( 100, 100, this->getWidth()-120 , this->getHeight()-120);
//openGlCanvas2->setBounds( 100, 100, 100,100);//this->getWidth()/2-120 , this->getHeight()/2-120);
}
void resized()
{
openGlCanvas1->setBounds (100, 100, getWidth()-120, getHeight()-120);
}
…[/code]
can someone please tell me what I’m missing here?
thanks
Thomas