Resized() issue


#1

Hello,

I create a window herited from DocumentWindow.
In myWindow::resized(), I dont manage to put new information.

If i write :

void myWindow::resized(){ DocumentWindow::resized(); } it rules.

If :

void myWindow::resized(){ DocumentWindow::resized(); aComponent->setBounds(0,0,4,5); }
it crashes at the window creation.

Is there an error in this code ?
Would you help please…?


#2

Sounds like a familiar old case of resizing the component in the constructor before you’ve actually initialised aComponent…


#3

Exact, thanks Jules.


#4

well, in fact no.
I ve deleted the resize methods from the constructor,
and I ve put them in the resized() method.

It crashes again…


#5

I think you need to spend some quality time with your debugger. It’ll be something silly.


#6

Well, shame on me, i had forgotten the “element(0)” spec :

[code]MyClass:MyClass : public MotherClass, element1(0), element2(0)…
{

};
[/code]

And that’s all

thank you for your patience.