Dialog window not showing resize/buttons


#1

okay, more dumb questions.

i’m setting up a dialog window that shows up on the desktop, is moveable, and has a titlebar, draws its components correctly, etc. but it doesn’t have titlebar buttons/nor resizability.

this is my code:

//==============================================================================
class PreviewWindow  : public DialogWindow
{
    //==============================================================================
    PreviewCanvas* canvas;

public:
    //==============================================================================
	PreviewWindow()	: DialogWindow ( T("Preview"), Colours::lightgrey, true, true )
    {
		canvas = new PreviewCanvas();
		
		
		setOpaque (true);
                                setVisible (true);

		
		centreWithSize(640,480);
		toFront (true);	
		setAlwaysOnTop(true);

		setTitleBarButtonsRequired(allButtons, false);

		setResizable (true, false);

		setContentComponent(canvas);
	}

    ~PreviewWindow()
    {
        deleteAllChildren();
    }

    void resized()
    {
		canvas->setBounds (10, 60, getWidth() - 20, getHeight() - 105);
    }
};

my PreviewCanvas is an opengl canvas, but i can strip that out and just have an empty window that still has the same issue.

i’m getting my window by simply calling

previewWindow = new PreviewWindow();

what am i doing wrong?


#2

If you overload resized(), you’ll have to make sure you call the parent class’s resized() method too - that’s where the parent class does some important stuff.

But of course, you don’t actually have to resize the canvas, because the content component is automatically kept at the right size. So just delete your resized() method and it’ll be fine.


#3

awesome – that fixed it.

if i wanted to over-ride the canvas resizing, how would i do that?


#4

why would you?

for most purposes it is enough to override the content component’s resize if you need to know about window resizing.


#5