How to resize the DialogWindow to fit the content component?


#1

Hi there,

I’m now writing a dialog. I’d like to know how to get the height of title bar and thickness of dialog’s border to fit the dialog size to content component.

I could use DocumentWindow::getBorderThickness() but I found ResizableWindow::resizeToFitContent() and DocumentWindow::getTitleBarHeight() are private.

Are there any way to get the height of the title bar in the DialogWindow? Or are there any way to resize the DialogWindow to fit the content component?

Best regards,
Masanao Hayashi


#2

It’s much easier than that - the ResizableWindow::setContentComponent() method has a “resizeToFit” parameter, which you can set to true.


#3

Thanks. It works! Now I’m doing as follows.

setOpaque(true); setVisible(true); setResizable(false, false); setTitleBarHeight(22); setContentComponent(new CMainPane, true, true); centreWithSize(getWidth(), getHeight());

Masa


#4