DialogWindow::LaunchOptions content


#1

Hello,

I’m being really stupid here but I can’t figure out how to get a component to show in a dialog window. Can anyone point me in the right direction? I’m getting a window, but with no content. Also, how do I define the size? Here’s what I’m doing…

[code]DialogWindow::LaunchOptions launchOptions;

launchOptions.dialogTitle = (“Help”);
launchOptions.escapeKeyTriggersCloseButton = true;
launchOptions.resizable = false;
launchOptions.useNativeTitleBar = true;
launchOptions.useBottomRightCornerResizer = false;
launchOptions.componentToCentreAround = this;

ScopedPointer helpme;
launchOptions.content.set(helpme, true);
launchOptions.create();

launchOptions.launchAsync();[/code]

Cheers


#2

Set the size of your content i.e. helpme just after you create it, you’re window will be resized around int. This also probably shouldn’t be a ScopedPointer if you’re passing ownership to the DialogWindow. You might also have to call setVisible (true) on either the DialogWindow returned from launchOptions.create().


#3

[quote=“mibix”]
I’m being really stupid here but I can’t figure out how to get a component to show in a dialog window. Can anyone point me in the right direction? I’m getting a window, but with no content. Also, how do I define the size? Here’s what I’m doing…[/quote]

Try this:

... launchOptions.content.setOwned(new HelpComponent()); launchOptions.content->setSize(640, 480); launchOptions.launchAsync();


#4

Thank you Stefan,

That worked perfectly. I presume the new HelpComponent() will be removed from memory when the DialogWindow is closed as is is set owned?

Cheers,
Adam


#5

Exactly.